How to 'cap' velocity?

Aug 17, 2010 at 12:46 AM

I saw in a previous post, Andy mentioned using drag to cap velocity. I was really hoping there was a way I could have drag to zero, but still cap velocity.

In my case, the gravity of the world is (0,0). When I want an object to move based on user input, I want to set drag to zero, continually add to velocity to make it move. When input ends, I simply stop adding to the velocity an set drag to something that will make it slow.

Can vector.Normalize give me the speed? How can I detect 'speed' to determine what I want max speed to be?



Aug 17, 2010 at 1:01 AM

Ok.. so I think I might get it. Can I just use Vector.Lenght() ?