Sir,
I’m new on P3D and i come from Blitz3d world.
On Blitz3d i have a standard useful template. I woul like to do the same with P3D.
My Blitz3d code is the following.
;Global variables
t=0
myCam=0
myCube=0
myLight=0
lastFPS=0
FPS=0
; Environment Settings
Graphics3D 640, 480, 0, 2
SetBuffer BackBuffer()
SeedRnd MilliSecs()
AppTitle "My Blitz Application"
t = MilliSecs() + 1000
; Create my app camera, cube and light
myCam=CreateCamera()
myCube=CreateCube()
PositionEntity myCube, 0,0,7
myLight=CreateLight()
; Main loop
While Not KeyDown(1)
; Frame rate
If MilliSecs() >= t Then
lastFPS = FPS
FPS = 0
t = MilliSecs() + 1000
End If
FPS = FPS + 1
TurnEntity myCube,.4,-.2,-0.5
RenderWorld
Text 0,0, "FPS="+lastFPS
Flip False
Wend
EndGraphics
End
Can you help me to translate this on Panda3D, please ?
Another fellow blitzer .
Anyways, there is not an easy way to do tweening in Panda3D, although I have a suspicion that my code posted in the code snippets forum is awful close (just slow as molasses for complex scenes)…it really needs to be rewritten in c++…
Anyways, the best way to do things in Panda is to use delta timing, which can be accessed by creating a task and then using task.dt.
so…in code:
import direct.directbase.DirectStart
from pandac.PandaModules import *
class game(object):
def __init__(self):
#do initialization code...
taskMgr.add(self.update,'update task')
def update(self,task):
#called once a frame...
return task.cont
game()
run()
hi patmaba
did you already checked out the hello world in the manual? It shows a simple setup or template with a ‘tweening’ of the camera turning around a panda in a simple environment. For more powerful ‘tweenings’, here called intervals, you would go in the ‘intervals’ section of the manual, clicking here.
enjoy!
thanks for your feedback
How to set a FPS to 60 frame per second ?
Doc say about Interval it’s set a time to execute a specific code. It’s like a timer expired.
Second question, what about the createcube from b3d in p3d solution ?