- Home /
Object moves Upwards instead or Left
the object i wanted to make is a missile. But instead of moving left it moves upwards. I cant find out why exactly.
public int damage = 1;
public float speed;
public float maxSpeed = 40;
public float acceleration = 2;
private void Update()
{
if (speed < maxSpeed)
{
speed = speed - acceleration;
}
transform.Translate(Vector2.left * Time.deltaTime * speed);
}
Comment
Answer by Casiell · Apr 14 at 06:09 PM
Unless explicitly specified, transform.Translate moves object in local space. So if your object or it's parent is rotated the object will move in another direction.
You want to add Space.World as a second parameter if you want independent movement
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Rendering using the Transparent queue 1 Answer
Double sided 2d sprite 1 Answer
Finding the Height of the Platform the Player is Standing On. 0 Answers