Game Development Community

Force, Speed, and Velocity problems.

by David Cobb · in Torque Game Builder · 03/14/2005 (12:55 am) · 4 replies

Why is setImpulseForce framerate dependent?

I've got missiles that I'm firing from my helicopter. They all have the same impulse applied to them which should result in the same velocity. Unfortunately that is not the case. Some speed off like mad and others poke along which suggests to me that this is a framerate dependent thing. Impulses are instantaneous and shouldn't have anything to do with time.

Note: I'm only setting an impulse force because I can't find the sin and cos functions in torquescript and there's no setVelocityPolar() function. Also missing is any concept of the speed of an object (setMaxSpeed, setMinSpeed) which I would use in conjunction with setConstantForce to have accelerating, directional missiles that top out at a max speed. :)

#1
03/14/2005 (12:57 am)
There is a setLinearVelocityPolar()
#2
03/14/2005 (1:01 am)
This has been posted quite a few times now but the results are scattered over the forum a bit. There was a minor problem with the integration routine that calls the scene-update resulting in some strange behaviour. This has now been fixed and will be part of the next update.

If your framerate is fairly consistent, you won't see drastic differences.

All it takes is a quick browse of the fxSceneObject2D in the reference doco to reveal "setMaxLinearVelocity()". You did read the reference document didn't you? ;) *kidding*

- Melv.
#3
03/14/2005 (2:20 am)
Whups! I guess I missed it because I've been at this for too long and the pdf is so small on my comp. Wow...how did I miss those? My brain == dead. Sorry about that, guys.

Good thing I wrote all that code to get around this stuff...

*delete delete delete delete*

Oh well. Was a good brush up on some 2D maths.

: )
#4
03/14/2005 (3:10 am)
No problem Dave. :)

The tutorials and better doco will hopefully help make this stuff more obvious in the future though.

- Melv.