Hello in my movementscript im trying to rotate the player when D or A is pressed accordingly. I set up a rotationpoint and made sure it rotates around that point. But the player still rotates around an other point and it makes the player slide around on the ground like the moon around earth. If i switch between pivot and center it is in the same place! here is my code i dont know what im doing wrong:
//ROTATE
if (Input.GetKey (KeyCode.D)) {
transform.RotateAround(RotatePoint.transform.position, Vector3.up, 2);
}
if (Input.GetKey (KeyCode.A)) {
transform.RotateAround(RotatePoint.transform.position, -Vector3.up, 2);
}
Usually if you’re rotating an object, the rotation is done in the object’s local space. By using RotateAround in that manner, you’re telling your object to rotate around a fixed axis in world space. So, let’s say you have an rotation point at the origin <0, 0, 0>, and your object is at <1, 0, 1>. As the object rotates with RotateAround, its position will update with respect to the origin, so essentially its path will draw a unit circle about the origin parallel to the xz plane.
To account for the objects position in world space, simply use transform.Rotate(Vector3.up, 2);
Thank you @Vicarian for pointing out that im getting the charactercontroller speed from A and D as well from Input.GetAxis!