|
I've decided to dive back into XNA again and mess about with it again, but this time in 3D. I have a spaceship (one of the models you are given with the SDK) and I have it moving around in 3D space quite well. You point it in any direction (up/down/left/right/back/fourth etc.) and it flies along that vector, I've implemented quat’s for proper rotations and all that jazz. What I'd like to do is add proper acceleration. At the moment it accelerates along the vector until it hits full speed, but when you turn it just flies off in that direction instantly, which doesn't really happen in the real world. What I'd like is smoother turning and acceleration, ie. It flies off in one direction then when you turn somewhere else and hit the thrusters again instead of insta-accelerating it gradually gets into its new vector. I have implemented something that half does this but it's totally wrong as it doesn't work 100% of the time. I've tried looking up how to do this but I am blinded by science and formulas and I am not sure how to implement it at all. What I have so far is: A vector in which the ship is currently moving (momentum I guess) A Vector which the ship is pointing in Current thrust level (could be zero, leaving the ship to 'float' on it's current vector) I am guessing I need to go from the momentum vector to the new direction vector based on the amount of thrust, but I don't know how. If someone can tell me how to implement acceleration or point me to a good tutorial (I've looked at loads but most are either 2D and I can't figure out how to translate that to 3D, or they just ramble on about something quite unhelpful) I'd be most grateful. I think I really need an example or it spelt out in English with little words that I can understand
|
# ¿ Jan 4, 2008 12:45 |
|
|
# ¿ May 8, 2024 02:05 |
|
Thanks fryzoy and TSDK, that worked a treat! Now I need to figure out how to limit the speed, but I think I have an idea on how to do that.
|
# ¿ Jan 4, 2008 15:16 |
|
Just to clarify, is |V| the Length of the Velocity Vector? If so, I think I understand what you're getting at. I'll give this a try when I get home this evening. What I had before is that I pre-calculated the maximum momentum vector based on my desired maximum speed and prevented the velocity vector from increasing any further when it hit this value, the ship would be travelling in a straight line when it hit this value. I think this was broken (or poorly implemented).
|
# ¿ Jan 4, 2008 16:27 |