Ejemplo n.º 1
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="motion"></param>
        /// <exception cref="T:System.ArgumentOutOfRangeException"></exception>
        protected override void InnerApplyMotion(IMotion motion)
        {
            var m = motion.Strength;

      #if NEODROID_DEBUG
            if (this.Debugging)
            {
                Debug.Log(message: $"Inner Applying {m} To {this.name}");
                Debug.Log(message: $"Current rotation of {this.name} is {this.transform.rotation}");
            }
      #endif

            if (motion.ActuatorName == this._x)
            {
                this.transform.Rotate(axis: Vector3.forward, angle: m);
            }
            else if (motion.ActuatorName == this._z)
            {
                this.transform.Rotate(axis: Vector3.right, angle: m);
            }

            this.transform.rotation = RotationClamping.ClampRotation(temp_eulers: this.transform.rotation.eulerAngles,
                                                                     low: this.limits.Max.x,
                                                                     high: this.limits.Max.x);
        }
Ejemplo n.º 2
0
        void Update()
        {
            if (this.maxRotationDegrees > 0)
            {
                // Apply the 'pre-clamp' rotation (rotation-Z and rotation-X from X & Y of mouse, respectively).
                this.SimpleRotation(mouse_xy: this.GetMouseInput());
            }

            if (this.ClampToMaxRotationDegrees)
            {
                // Clamp rotation to maxRotationDegrees.
                this.transform.rotation = RotationClamping.ClampRotation(temp_eulers: this.transform.rotation.eulerAngles,
                                                                         low: this.maxRotationDegrees,
                                                                         high: this.maxRotationDegrees);
            }
        }