Game Development Community

Vector Stuff

by Chris · in Torque Game Builder · 12/27/2005 (8:55 am) · 1 replies

I am currently trying to add two forces together for use with applying impulses to a sprite. Impulse works by using an angle and then an impulse amount. I am looking for the ability to take my currently linear polar velocity and adding in my impulse to allow a more "friction free" setup. What I mean by "friction free" currently if you use the strafing movement and let go then wait a little bit and hit the front movement button you wont notice any sliding from the inertia of your strafing movement. Another reason I am looking to do this is because of combined movement. Right now you can only hold one movement button down. If you use another movement button at the same time (like back and left) it doesn't work well. You get a lot of jittery action. If anyone has any ideas on how to do this please post them.

Lux

#1
02/16/2006 (7:31 am)
Christopher... You could slowly add velocity to your player object based on what key is pressed, but add it fast enough for the player to gain normal speed quickly... decrease the same way... and cap the length of your velocity vector.

Alternatively, to get a bit of sliding, you could take the velocity vector, and add it with the cumulative result of all force vectors, then normalize.... This will move your direction vector from the volocity to the force over time. You could weight the force vector to change hoe fast or slow the velocity changes. This can provide 2 different effects... A player with some kind of inertia behind his mass, and a hover vehicle, just by changing a variable.

Hope this helps.

You don't want to deal with inertia, you want to deal with forces.