Hide
RotationHandle

Draw a rotation handle on the target to adjust.

  • If it's a GameObject or Component, rotate the target
  • If it's a Quaternion, save the rotation to the target. The parent space is decided by the space parameter
  • If it's a Vector3, save the rotation as Vector3. Note: quaternion converting to Vector3 will have value flicking (because quaternion is actually a 4-demision value). You can still convert between the two types, but the number value of each axis may not "look" correct when you drag the handle. For example, you may notice all axis value changes when you only drag one.
  • If it's a number (int, double, float, long etc.), use it as the z-axis rotation.

Parameters

  • string space = "this": : parent of the rotation. When using this, use the current object as target space. When using null, use world space. Otherwise, use the target field/callback as the parent.
  • float posXOffset = 0f: local position offset at the x axis
  • float posYOffset = 0f: local position offset at the y axis
  • float posZOffset = 0f: local position offset at the z axis
  • string posOffsetCallback = null: use a field/callback as the local position offset. Must return a Vector3.
using SaintsField; [RotationHandle] // make a target always show rotation handle by default public GameObject go; // make a vector3 rotation as a local rotation inside go [RotationHandle(nameof(go))] [OnValueChanged(nameof(ApplyRotToChild))] // let's see the changes in real time public Quaternion rotationInside; public Transform applyTo; private void ApplyRotToChild(Quaternion rotation) { // Debug.Log(rotation); applyTo.transform.localRotation = rotation; } [RotationHandle] public float rotationZFor2D; // in 2D game usually only z axis works // lets lock x, z to 0 using MinValue/MaxValue [MinValue(position0: 0, position2: 0)] [MaxValue(position0: 0, position2: 0)] [RotationHandle] public Quaternion quaternionLock;