Rotation Handle for Y axis only

Hello,

I’m trying create rotation handle for Y axis for my custom editor. I need it for virtual items so there is no game object for it. The input parameters are position vector and Y rotation angle. I have following code now:

var originalRotation = Quaternion.identity;
var newRotation = Handles.RotationHandle(originalRotation, position);
float angle = 0.0f;
Vector3 axis = Vector3.zero;
newRotation.ToAngleAxis(out angle, out axis);
// Check if rotation angle was changed for Y axis
if (axis.y != 0)
{
    // TODO: apply new rotation angle from axis.y
}

It works but there are 2 issues.

  1. It starts with Y zero angle. So I do not know how to setup Quaternion with my initial angle, for example 30°
  2. It renders handles for all axis (x, y, z). Is there possible to render only Y axis handle? For example I have Handles.ScaleSlider used for rendering scale handler for Z-up axis

Thank you

I’ve been trying to solve a similar problem with the handles - what you want is “Handles.Disc” Unity - Scripting API: Handles.Disc

for example:

target.transform.rotation = Handles.Disc(target.transform.rotation, target.transform.postion, Vector3(0, 1, 0), 1, true, 0);