how to control speed relative to the reall world.

I know that you can move a 3d object to certain point in space at a certain speed.


The documentation says that the speed in this code is 1.Im making a little car game and i want to know what that value is relative to in the reall world.
Thanks greatly.

the answer to your question might be “none” as well as “green” or “blue” :wink:
well if you want a “real” speed you need to decide on a “real” scale. time in panda usualy is pretty close to reality. but you can make 1 panda unit to be as large as a planet or as small as atom.
in a simple case just take 1panda unit as your prefered system like 1meter or 1feet.
once you decided you could easily calculate the meters or feet per second.
small example with 1panda unit as one meter:
lets take a bycicle with 20km/h … would make roughly 5.5 meters per second. in our case 5.5 panda units per second.

hope this helps a little 0)

thanks for your reply
What you say is very logical.
Ill take on board what you said.
i remebered my physics teacher telling about how time and space is all relative.I guess i had forgotten that,lol

Oh, if you want for example to move something 1 m/s, and you use 1 meter = 1 panda unit, you have to check the frame time, because the number of frames per second varies.

To be honest, I don’t think an interval is the way to go for moving a car. I would definately set up a task and capture “dt” from the task and then use basic physics formulae to get what you want.

dt = task.time - task.last  #obtains the time since that last frame.
		task.last = task.time

Then do something simple like:

x = dt * 5
return Task.cont

If you have the task setup you’ll see the nodepath move in the x direction 5 units per second.

thanks allot mavasher
im abit confused about task.time and time.last
there could so many tasks running and so does this affect all tasks

when i typed in the code
it gave me an error saying that task is not defined

try adding

from direct.task import Task 

to the import lines

i already had as i was using tasks in my code

Note that Python’s variables are case sensitive.

so Task is a different thing than task.