Is it a problem with unity or my code?

So i was making a rocket simulatorand i noticed when the rocket started tiping over and i was using the arrow keys to move it back up it kept falling in that same direction even if i moved it so it was tiping the other way it would still tip that one way is that just unitys gravity or is my code doing somthing that is causing an issue

heres the part of the code

 //This is for rotation
	if(Input.GetKey(KeyCode.Q))
 	       transform.Rotate(Vector3.forward * 1 * 2.00);
    
	if(Input.GetKey(KeyCode.E))
 	       transform.Rotate(-Vector3.back * -1 * 2.00);

	if(Input.GetKey(KeyCode.LeftArrow))
	        transform.Rotate(Vector3.left, 1 * 2.00);
    
	if(Input.GetKey(KeyCode.RightArrow))
  	      transform.Rotate(-Vector3.right, -1 * 2.00);
  	      
	if(Input.GetKey(KeyCode.UpArrow))
	        transform.Rotate(Vector3.up, 1 * 2.00);
    
	if(Input.GetKey(KeyCode.DownArrow))
  	      transform.Rotate(-Vector3.down, -1 * 2.00);

Hey ZXYNINE!

If you have put the rigidBody component, the rocket could clearly react to gravity…

Are you only rotating the object or you are moving it to?

What do you mean by “tiping”? The Rocket lean for the ground instead of turing on “Z” axis? Please be more precise… I’ll try giving you a hand.

Math

Hi,
Not sure what you are looking to do, but perhaps to test you can:

  • have a look at the rigid body component of your game object in the inspector
  • uncheck “use gravity” and see if that does what you want.
  • if you want your object to interact with others - make sure you check “is kinematic” and has a collider component on it.

not sure if that helps,
M