# Any help will be supported

**So, I have completed roll a ball tutorial, the game I created seemed a little too simple for me so I have added alot of additional things. One of those is mouse-controlled orbit camera, I coded the ball to roll same direction, as camera is looking. The problem is, that, if I look up or down, the ball rolls slower, because it’s supposed to roll in ALL direcions (X, Y, Z).

How do I make it roll same speed, no matter what heights camera is looking at?
Here is my code:**

``````    void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");

Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
movement = Camera.main.transform.TransformDirection(moveHorizontal, 0.0f, moveVertical);
Vector3 forcedmovement = new Vector3(movement.x * speed * Time.deltaTime, 0, movement.z * speed * Time.deltaTime);
forcedmovement.z = Mathf.Clamp(forcedmovement.z, -100, 100);
forcedmovement.x = Mathf.Clamp(forcedmovement.x, -100, 100);
GetComponent<Rigidbody>().AddForce(forcedmovement.x - GetComponent<Rigidbody>().velocity.x/1, 0 , forcedmovement.z - GetComponent<Rigidbody>().velocity.z/1);
Debug.Log("speed: " + GetComponent<Rigidbody>().velocity.x);
}
``````

How you can see, I have already worked on it, since the ball was even flying up, if I looked up, and also made the ball lose inertia over time.

It seems like the only part of the camera rotation you care about is the “yaw” or how it’s rotated around the up axis. If you are rolling it according to the camera’s full rotation you’re either pushing it into the ground or fighting against gravity.

To achieve this, where you transform you movement using the camera transform, instead take the y element of the camera transform’s euler angles then rotate movement around the up axis using this value.