When my object is rotating, the object doesn't moving toward to the position I want it to be
Here's my code :
transform.Rotate (0,0, 3.0f);
transform.Translate(0, -movespeed * Time.deltaTime, 0);
When my object is rotating, the object doesn't moving toward to the position I want it to be
Here's my code :
transform.Rotate (0,0, 3.0f);
transform.Translate(0, -movespeed * Time.deltaTime, 0);
Translate moves your object according to its own transform orientation, so you could probably do 1 of 3 things:
Put the game object you want to rotate inside of another game object, then you can rotate it however which way you want and just translate the parent in the direction you want to go.
Set the direction you want him to travel more explicitly...
transform.Translate(SomeTransform.up * -movespeed * Time.deltaTime);
Pass a "relativeTo" parameter...
transform.Translate(new Vector3(0, -movespeed * Time.deltaTime, 0), Space.World);