I am making a game, where the player is a ball. When the players body starts to move, I want it to rotate, so it would look like a rolling ball. Apparently,I tried doing so and it didn’t work.
void FixedUpdate () {
horizontal = Input.GetAxis(“Horizontal”);
vertical = Input.GetAxis(“Vertical”);
Movement(horizontal, vertical);
}
void Movement(float horizontal, float vertical) {
PlayerRigidBody.velocity = new Vector2(horizontal * movementSpeed, PlayerRigidBody.velocity.y);
transform.localRotation = new Vector2(transform.rotation.x + 1, 0); // Here is where I get an error.
}
}