Hi
I am having some problems with my ship controller. I have want it to move up, down, left and right but when I try to move up or down it only moves by 0.1.
Here’s my script.
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, moveVertical, 0.0f);
GetComponent<Rigidbody2D>().velocity = movement * speed;
GetComponent<Rigidbody2D>().position = new Vector3
(
Mathf.Clamp(GetComponent<Rigidbody2D>().position.x, boundary.xMin, boundary.xMax),
0.0f,
Mathf.Clamp(GetComponent<Rigidbody2D>().position.y, boundary.yMin, boundary.yMax)
);
GetComponent<Rigidbody2D>().rotation = -GetComponent<Rigidbody2D>().velocity.x * tilt;
Debug.Log(moveHorizontal);
}
I can not see anything wrong with it.
Thanks in advance