1
$\begingroup$

What velocity should I set an object to in order to have it travel 30 Blender Units in 0.25 seconds.The object will be traveling on its Y local axis. This is being done in python rather than an actuator because I couldn't get the results I needed, and I imagine that there is a specific syntax for velocity. This object is being spawned on a click. Then, when its timer property is 0.25 or more, it dies. I need it to travel that exact (or pretty close...no one would notice that much) distance before then.

$\endgroup$
  • 1
    $\begingroup$ I'm not sure, but I believe you could just use velocity=distance/time, in your case velocity=30/0.25 or 120 BU/s. Not this only works if your object is travelling at a constant speed, and you need to make sure you're using the correct units BU/s, not BU/frame (the conversion factor is your fps) or something else $\endgroup$ – Michal Jan 18 '14 at 22:15
  • $\begingroup$ So if I want it to travel 120BU/s on the local Y-axis, what would the syntax look like? $\endgroup$ – user3015600 Jan 20 '14 at 15:04
1
$\begingroup$

Use velocity=distance/time, in your case velocity=30/0.25=120 BU/s however the blender game engine units are BU/game-frame (default=60) therefore the correct value would be 2 BU/game-frame. To make the object travel 120BU/s on the local Y-axis, I believe you need to use (assuming default game-frame):

setLinearVelocity((0.0,120.0,0.0),True)

EDIT: Apparently the units are BU/s

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.