RemoteTech.Pivot.RotToOrigin C# (CSharp) 메소드

RotToOrigin() 공개 메소드

public RotToOrigin ( ) : bool
리턴 bool
        public bool RotToOrigin()
        {
            Vector3 tmpTGT = OrigRef;
            Vector2 target = new Vector2(tmpTGT.x, tmpTGT.y);

            float angle = Mathf.Deg2Rad * Vector2.Angle(Vector2.up, target);

            if (angle == 0) return true;

            angle = Mathf.Clamp(increment * TimeWarp.deltaTime, 0, angle);
            if (target.x > 0)
                angle = -angle;

            if (!fullcircle)
            {
                target = new Vector2(tmpTGT.x, tmpTGT.y);
                float angleRef = Mathf.Deg2Rad * Vector2.Angle(Vector2.up, target);
                if (target.x > 0)
                {
                    angleRef = -angleRef;
                }

                angle = Mathf.Clamp(angle, angleRef - angleMinus, angleRef + anglePlus);

                if (angle != 0)
                    pivot.RotateAround(pivot.forward, angle);
            }
            else
                pivot.RotateAround(pivot.forward, angle);

            return false;
        }

Usage Example

예제 #1
0
        public new void FixedUpdate()
        {
            base.FixedUpdate();

            if (IsRTBroken || !RTCore.Instance)
            {
                return;
            }

            switch (TrackingMode)
            {
            case TrackingModes.Tracking:
                if (IsRTPowered)
                {
                    mPivot1.RotToTarget(new DynamicTarget(RTAntennaTargetGuid));
                    mPivot2.RotToTarget(new DynamicTarget(RTAntennaTargetGuid));
                }
                break;

            case TrackingModes.Extending:
                if (!Animation.IsPlaying(AnimationName))
                {
                    TrackingMode = TrackingModes.Tracking;
                }
                break;

            case TrackingModes.Retracting:
                if (!Animation.IsPlaying(AnimationName))
                {
                    TrackingMode = TrackingModes.Retracted;
                }
                break;

            case TrackingModes.Resetting:
                if (IsRTPowered && mPivot1.RotToOrigin() & mPivot2.RotToOrigin())
                {
                    TrackingMode = TrackingModes.Retracting;
                    base.SetState(false);
                }
                break;
            }
        }
All Usage Examples Of RemoteTech.Pivot::RotToOrigin