I've tried almos all the ways to make my rotaion smooth with no luck; I have a capsule collider with rigidbody. I want to make a simle fish behavior with jump from the water and fall back. Jump: Code (csharp): if(Time.time > JumpDelay) { JumpDelay = Time.time + JumpRate; rigidbody.AddForce(Vector3.up*jumpForce, ForceMode.Impulse); } rotate to move dir Code (csharp): transform.up = rigidbody.velocity; How to smooth?
You can use this to set the rotation based on the velocity Code (csharp): transform.rotation = Quaternion.LookRotation(rigidbody.velocity); To rotate smoothly, you can use Quaternion.RotateTowards like so Code (csharp): Quaternion toRotation = Quaternion.LookRotation(rigidbody.velocity); transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, Time.deltaTime * yourSmoothingValue);
Im newby, but found yesterday those tutorials, maybe you find the answer there.. Slowly rotates towards the target: http://unity3d.com/learn/tutorials/modules/intermediate/scripting/quaternions Smoothly locate with Lerp.. http://unity3d.com/learn/tutorials/modules/beginner/scripting/lerp Maybe it helps..
I've tried this way, and it won't rotate properly.. The camera is looking from the side with positive Z -> right. I need to rotate my fish in negative, or positive X axis.