- Home /
Rigidbody being affected by wind resistance - and wind!
Im working on a old project I had lying around where you just launch rockets and they come back down... and thats it. Heres webplayer: https://dl.dropboxusercontent.com/u/76853021/RocketGameWebPlayer/WebPlayerDemo.html
I was sort of halfway faking wind, by adding some randomish wind forces after launching, to make each launch a little different yaknow.
But watching a few launches I am noticing, I need wind resistance to work right, because my rocket reaches the peak of its launch, where it should be flipping over its center of mass, and pointing downwards from its aerodynamic shape hitting the wind resistance. How can I do this in unity? or how can I fake it good :D
Here is a little image to describe my desired effect:
ID$$anonymous$$ if this might be what I need, but I will look into this tomorrow, and if it works for me I'll post what I get going
http://answers.unity3d.com/questions/18853/Basic-aerodynamics-questions.html
the center of mass moves towards the tip as the rocket burns fuel. If you look for wind in the literature you won't find what you need: wind simulation in aeronautics is really the wind that hits the rocket in some arbitrary direction and doesn't change often, but what makes your rocket behave like you want is not the wind, is the center of mass, the location of the rocket force and the forces exert from the control of the "wings".
then maybe scripting a change in the center of mass would cause this effect? hmmm, I will mess around with this, I had been trying to just change the mass for the entire playtime, but thinking now, your right that might just be what I need.
EDIT: seems that changing the center of mass of my object at runtime doesnt flip it when hitting the peak of the launch, or at all :/
I tried making it heavier with more thrust power, more drag... nothing seems to help!
I tried: transform.LookAt(transform.position + rigidbody.velocity);
but that just causes it to look really really fake, but almost looks like I need it too, but screws up physics effecting the rigidbody as well...
To improve (but not completely fix) the situation add this to the LateUpdate() of the rocket:
if (rigidbody.velocity != Vector3.zero)
transform.rotation = Quaternion.LookRotation(rigidbody.velocity);
It will work better if your rocket is launched at a bit of an angle.
thats what I had just tried (well transform.LookAt...) but I will give this a try anyway, ill report back in a few...
EDIT well sort of would work, buy doesnt "look" with the "up" of my rocket properly, ins$$anonymous$$d shoots off to the side ins$$anonymous$$d of looking with the tip of the rocket (the "front" of the rocket is the side, which is what "looks" at the target)... ill look into this further to see if I can get that working better...
Your answer
Follow this Question
Related Questions
How can I give an object realistic wind? 0 Answers
Directional Explosion 1 Answer
Rigidbodies flying up in the air on collision 4 Answers
How would you code a Wind script? 1 Answer
Add a wind vector to local velocity for calculating wind speed 2 Answers