I have a simple marble rolling game right now. The marble will move and everything, but only along the x and z axis relative to the world.
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce(movement * speed * Time.deltaTime);
}
i have a camera mouse orbit applied to my main camera so the player can orbit around the ball. However, even if i move the camera, the ball doesn’t change. It will still move along the world axis. If i have the camera facing one way and I make the ball move forward, instead of it moving in the direction I’m looking it moves forward in the world. How can i change this so the ball moves relative to the camera? thanks in advance.