I've been trying to work out what I think is a really simple problem - But I just can't solve it.
I have a missile that's being launched (a simply cylinder default model). The missile is given a Z and Y velocity, so it fires and arcs correctly under gravity.
I want the missile to face the direction it's moving, so it rotates depending on its velocity.
I've tried using lookat but it doesn't seem to work - There's an added problem that if it does work, the original cylinder model is 90 degrees out (i.e, the original model will look like a vertical pillar if fired forwards, rather than a horizontal, er..sausage..)
Create an empty parent for your rocket. Then rotate the rocket so that it is correctly orientated inside the parent. Then instantiate an instance of your parent when you fire the rocket. This will solve the 90 degree rotation problem.
The easiest way to get a missile (parent gameObject) to arc is to have it face its velocity. So, assuming that your missile is like the majority in the world it will face up on the way up, and down on the way down.
Or better, use AddTorque to slowly (or quickly, depending on how much torque you add) to rotate the missile towards its velocity. To make it more realistic, make sure you scale the torque you add based on the off-axis velocity, as in:
If you just rotate the missile directly, it will be affected too heavily by gravity.
It may also be a good idea to manually script drag in the direction perpendicular to the movement (sideVelocity *= (1 - dragSide); and then adjust the velocity itself accordingly).