People who code: we want your input. Take the Survey
2

If you have an object whose transform is already rotated the way you want on the z axis (and not rotated on the x and y), then this is as simple as: Vector2 direction = -transform.up; Otherwise, you can construct the rotation you want and rotate the "down" vector by it: Vector2 RotationToVector(float degrees) { Quaternion rotation = ...


1

If your object always remains upright (green vector always points up), then this is as simple as zeroing out the y component of your target direction. Vector3 targetDirection = targetToRotateTo.position - transform.position; targetDirection.y = 0f; if (targetDirection != Vector3.zero) { float singleStep = rotationSpeed * Time.deltaTime; transform....


Only top voted, non community-wiki answers of a minimum length are eligible