I am creating a 3d platformer where there is arbitrary gravity. As such the player jumps from planet to planet and orients towards the gravity…at least that is my intention.
My current code below takes the players movement input vector and applies rotation based on the input value. How can I add the gravity Vector3 to the code below?
Vector3 Gravity = GravitySource.GetGravity();
Vector3 inputDirection = Vector3.Normalize(new Vector3(inputSource.GetRawMove.x, 0.0f, inputSource.GetRawMove.y));
float _targetRotation = Mathf.Atan2(inputDirection.x, inputDirection.z) * Mathf.Rad2Deg + playerInputSpace.transform.eulerAngles.y;
float rotation = Mathf.SmoothDampAngle(transform.eulerAngles.y, _targetRotation, ref rotationSpeed, RotationSmoothTime);
transform.rotation = Quaternion.Euler(0f, rotation, 0f);