Rigidbody and transform.rotate?

Hi!

I’ve got a little problem with rotating an object with transform.rotate, while I use rigidbody.addforce to move it forward.
Right now my object rotates and when I let go of the keys used for rotating my game will have a slight lag of about a frame or 2.

I think it has something to do with using transform and rigidbody together. Is there some sort of alternative version of transform.rotate for rigidbodies?

Here’s the function I use to make my object move…

function Movement()
{
	if(!canHover && Input.GetAxis("Vertical") <= 0 && Controlled == true)//move the ship IF the ship can't hover, isn't pressing the forward key and is controllable
	{
		myRigidbody.AddForce(transform.forward*50000);
	}
	if(Input.GetAxis("Vertical") > 0 && Controlled == true)//If the player is pressing forward and the ship can be controlled, move forward
	{
		myRigidbody.AddForce(transform.forward*translation*100000);
	}
	transform.Rotate((-mouseY/1000*pitchSpeed),(mouseX/1000*yawSpeed),(-hor-mouseX/1000*rollSpeed));//Rotate the ship according to the mouse input
}

Anyway, any suggestions are highly appreciated!

Thanks in advance,

Nick

you need freeze rotations in rigidbody component if you want to change them with transform.Rotate instead of physics(rigidbody.addTorque)
if you don’t freeze them and use transform.Rotate you will have problems when it collides.

Try using rigidbody.MoveRotation instead if you’re using Rigidbody.

transform.Rotate should actually work fine also, try putting the function inside FixedUpdate?

watch this tutorial
@SomeRandomGuy