using UnityEngine.Scripting; namespace UnityEngine.InputSystem.Processors { /// /// Inverts the x and/or y and/or z channel of a Vector3. /// /// /// This process is registered (see as "invertVector3" by default. /// /// /// /// // Bind to gravity sensor such that its Y value is inverted. /// new InputAction(binding: "<GravitySensor>/gravity", processors="invertVector3(invertX=false,invertY,invertZ=false)"); /// /// /// /// public class InvertVector3Processor : InputProcessor { /// /// If true, the x channel of the Vector3 input value is inverted. True by default. /// public bool invertX = true; /// /// If true, the y channel of the Vector3 input value is inverted. True by default. /// public bool invertY = true; /// /// If true, the z channel of the Vector3 input value is inverted. True by default. /// public bool invertZ = true; /// /// Return the given vector with the respective channels being inverted. /// /// Input value. /// Ignored. /// Vector with channels inverted according to , , and . public override Vector3 Process(Vector3 value, InputControl control) { if (invertX) value.x *= -1; if (invertY) value.y *= -1; if (invertZ) value.z *= -1; return value; } /// public override string ToString() { return $"InvertVector3(invertX={invertX},invertY={invertY},invertZ={invertZ})"; } } }