I have a game object which spins in all the axes when i click on a plane. I want the object to stop from spinning on the Y axis because I am making a 2D game. Please give your valuable response as soon as possible. The code is...
function Update()
{
// Look at and dampen the rotation
var rotation = Quaternion.LookRotation(target.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime*damping);
}
Please help me soon. Thank you.
Thanks a lot for your answer :) it was really helpful. but.. can you provide me a sample code for that please ? i'm kinda new to Unity. Please do me this favor. Thanks again.
– anon72774511