# Player Movement Problems.

Hi, I have a player gameobject that accelerates forward and is able to move up, down, left and right. The only problem I have is that my movement script doesn’t allow the player to move up and down on the Y axis very far. I have tried changing the boundary size but nothing works. My code is a modified version of the movement script from the shooter tutorial, here it is:

``````class Boundary
{
var xMin : float;
var xMax : float;
var yMin : float;
var yMax : float;
}

var speed : float;
var boundary : Boundary;

function FixedUpdate () {
var moveHorizontal : float= Input.GetAxis ("Horizontal");
var moveVertical : float= Input.GetAxis ("Vertical");

var movement : Vector3= new Vector3 (moveHorizontal, moveVertical, 0.0f);
rigidbody.velocity = movement * speed;

rigidbody.position = new Vector3
(
Mathf.Clamp (rigidbody.position.x, boundary.xMin, boundary.xMax),
0.0f,
Mathf.Clamp (rigidbody.position.y, boundary.yMin, boundary.yMax)

);
}
``````

Does anyone know what is wrong?

You’ve put the y-compound into the z-compound in the Vector3 at line 22 and 23 like this.

``````rigidbody.position = new Vector3
(
Mathf.Clamp (rigidbody.position.x, boundary.xMin, boundary.xMax),
0.0f,
Mathf.Clamp (rigidbody.position.y, boundary.yMin, boundary.yMax)

);
``````

You should swap them around like this.

``````rigidbody.position = new Vector3
(
Mathf.Clamp (rigidbody.position.x, boundary.xMin, boundary.xMax),
Mathf.Clamp (rigidbody.position.y, boundary.yMin, boundary.yMax),
0.0f

);
``````