コード例 #1
0
        public override TaskStatus OnUpdate()
        {
            var go       = basegameObject.Value.gameObject;
            var goTarget = targetObject.Value;

            if (previousGo.Value != go)
            {
                lastRotation    = go.transform.rotation;
                desiredRotation = lastRotation;
                previousGo      = go;
            }


            // desired look at position

            Vector3 lookAtPos;

            if (goTarget != null)
            {
                lookAtPos = !targetPosition.IsNone ?
                            goTarget.transform.TransformPoint(targetPosition.Value) :
                            goTarget.transform.position;
            }
            else
            {
                lookAtPos = targetPosition.Value;
            }

            if (keepVertical.Value)
            {
                lookAtPos.y = go.transform.position.y;
            }

            // smooth look at

            var diff = lookAtPos - go.transform.position;

            if (diff != Vector3.zero && diff.sqrMagnitude > 0)
            {
                desiredRotation = Quaternion.LookRotation(diff, upVector.IsNone ? Vector3.up : upVector.Value);
            }

            lastRotation          = Quaternion.Slerp(lastRotation.Value, desiredRotation.Value, speed.Value * Time.deltaTime);
            go.transform.rotation = lastRotation.Value;

            // send finish event?

            if (successOnFinish.Value == true)
            {
                var targetDir = lookAtPos - go.transform.position;
                var angle     = Vector3.Angle(targetDir, go.transform.forward);

                if (Mathf.Abs(angle) <= finishTolerance.Value)
                {
                    return(TaskStatus.Success);
                }
            }
            return(TaskStatus.Running);
        }
コード例 #2
0
 public override TaskStatus OnUpdate()
 {
     if (this.rigidbody == null)
     {
         Debug.LogWarning("Rigidbody is null");
         return(TaskStatus.Failure);
     }
     this.rigidbody.rotation = this.rotation.Value;
     return(TaskStatus.Success);
 }
コード例 #3
0
 public override TaskStatus OnUpdate()
 {
     if (this.targetTransform == null)
     {
         Debug.LogWarning("Transform is null");
         return(TaskStatus.Failure);
     }
     this.targetTransform.rotation = this.rotation.Value;
     return(TaskStatus.Success);
 }
コード例 #4
0
ファイル: MatchTarget.cs プロジェクト: dev-celvin/DK
 public override void OnReset()
 {
     targetGameObject = null;
     matchPosition = Vector3.zero;
     matchRotation = Quaternion.identity;
     targetBodyPart = AvatarTarget.Root;
     weightMaskPosition = Vector3.zero;
     weightMaskRotation = 0;
     startNormalizedTime = 0;
     targetNormalizedTime = 1;
 }
コード例 #5
0
 public virtual void OnReset()
 {
     this.targetGameObject     = (SharedGameObject)null;
     this.matchPosition        = (SharedVector3)Vector3.get_zero();
     this.matchRotation        = (SharedQuaternion)Quaternion.get_identity();
     this.targetBodyPart       = (AvatarTarget)0;
     this.weightMaskPosition   = Vector3.get_zero();
     this.weightMaskRotation   = 0.0f;
     this.startNormalizedTime  = 0.0f;
     this.targetNormalizedTime = 1f;
 }
コード例 #6
0
 public override void OnReset()
 {
     targetGameObject     = null;
     matchPosition        = Vector3.zero;
     matchRotation        = Quaternion.identity;
     targetBodyPart       = AvatarTarget.Root;
     weightMaskPosition   = Vector3.zero;
     weightMaskRotation   = 0;
     startNormalizedTime  = 0;
     targetNormalizedTime = 1;
 }
コード例 #7
0
 public virtual void OnReset()
 {
     this.fromDirection = this.toDirection = (SharedVector3)Vector3.get_zero();
     this.storeResult   = (SharedQuaternion)Quaternion.get_identity();
 }
コード例 #8
0
ファイル: Instantiate.cs プロジェクト: dev-celvin/DK
 public override void OnReset()
 {
     targetGameObject = null;
     position = Vector3.zero;
     rotation = Quaternion.identity;
 }
コード例 #9
0
ファイル: SetRotation.cs プロジェクト: HaoYunSun/TEMPORAIRE
 public override void OnReset()
 {
     targetGameObject = null;
     rotation = Quaternion.identity;
 }
コード例 #10
0
 public virtual void OnReset()
 {
     this.targetGameObject = (SharedGameObject)null;
     this.storeValue       = (SharedQuaternion)Quaternion.get_identity();
 }
コード例 #11
0
 public override void OnReset()
 {
     targetGameObject = null;
     storeValue       = Quaternion.identity;
 }
コード例 #12
0
 public override void OnReset()
 {
     this.targetValue    = Quaternion.identity;
     this.targetVariable = Quaternion.identity;
 }
コード例 #13
0
 public override void OnReset()
 {
     targetQuaternion = storeResult = Quaternion.identity;
 }
コード例 #14
0
 public override void OnReset()
 {
     this.forwardVector = Vector3.zero;
     this.storeResult   = Quaternion.identity;
 }
コード例 #15
0
 public virtual void OnReset()
 {
     this.storeResult = (SharedQuaternion)Quaternion.get_identity();
 }
コード例 #16
0
 public override void OnReset()
 {
     firstRotation = secondRotation = Quaternion.identity;
     storeResult   = 0;
 }
コード例 #17
0
 public override void OnReset()
 {
     this.fromDirection = (this.toDirection = Vector3.zero);
     this.storeResult   = Quaternion.identity;
 }
コード例 #18
0
ファイル: Lerp.cs プロジェクト: request-time-out/A-Scripts
 public virtual void OnReset()
 {
     this.fromQuaternion = this.toQuaternion = this.storeResult = (SharedQuaternion)Quaternion.get_identity();
     this.amount         = (SharedFloat)0.0f;
 }
コード例 #19
0
 public override void OnReset()
 {
     degrees     = 0;
     axis        = Vector3.zero;
     storeResult = Quaternion.identity;
 }
コード例 #20
0
 public override void OnReset()
 {
     targetValue = Quaternion.identity;
     targetVariable = Quaternion.identity;
 }
コード例 #21
0
ファイル: Dot.cs プロジェクト: Barryzp/UnityLearningWorkSpace
 public override void OnReset()
 {
     leftRotation = rightRotation = Quaternion.identity;
     storeResult  = 0;
 }
コード例 #22
0
ファイル: Angle.cs プロジェクト: wishes2018/UnityGame
 public override void OnReset()
 {
     firstRotation = secondRotation = Quaternion.identity;
     storeResult = 0;
 }
コード例 #23
0
 public override void OnReset()
 {
     this.variable  = Quaternion.identity;
     this.compareTo = Quaternion.identity;
 }
コード例 #24
0
ファイル: Dot.cs プロジェクト: nowcoder001/dragonnest_src
 public override void OnReset()
 {
     this.leftRotation = (this.rightRotation = Quaternion.identity);
     this.storeResult  = 0f;
 }
コード例 #25
0
 public override void OnReset()
 {
     this.fromQuaternion  = (this.toQuaternion = (this.storeResult = Quaternion.identity));
     this.maxDeltaDegrees = 0f;
 }
コード例 #26
0
ファイル: RotateTowards.cs プロジェクト: dev-celvin/DK
 public override void OnReset()
 {
     fromQuaternion = toQuaternion = storeResult = Quaternion.identity;
     maxDeltaDegrees = 0;
 }
コード例 #27
0
ファイル: FromToRotation.cs プロジェクト: dev-celvin/DK
 public override void OnReset()
 {
     fromDirection = toDirection = Vector3.zero;
     storeResult = Quaternion.identity;
 }
コード例 #28
0
ファイル: AngleAxis.cs プロジェクト: wishes2018/UnityGame
 public override void OnReset()
 {
     degrees = 0;
     axis = Vector3.zero;
     storeResult = Quaternion.identity;
 }
コード例 #29
0
ファイル: Identity.cs プロジェクト: dev-celvin/DK
 public override void OnReset()
 {
     storeResult = Quaternion.identity;
 }
コード例 #30
0
ファイル: Dot.cs プロジェクト: wishes2018/UnityGame
 public override void OnReset()
 {
     leftRotation = rightRotation = Quaternion.identity;
     storeResult = 0;
 }
コード例 #31
0
ファイル: GetLocalRotation.cs プロジェクト: dev-celvin/DK
 public override void OnReset()
 {
     targetGameObject = null;
     storeValue = Quaternion.identity;
 }
コード例 #32
0
ファイル: Inverse.cs プロジェクト: nowcoder001/dragonnest_src
 public override void OnReset()
 {
     this.targetQuaternion = (this.storeResult = Quaternion.identity);
 }
コード例 #33
0
ファイル: Lerp.cs プロジェクト: chichichap/Unity
 public override void OnReset()
 {
     fromQuaternion = toQuaternion = storeResult = Quaternion.identity;
     amount         = 0;
 }
コード例 #34
0
 public override void OnReset()
 {
     this.degrees     = 0f;
     this.axis        = Vector3.zero;
     this.storeResult = Quaternion.identity;
 }
コード例 #35
0
 public override void OnReset()
 {
     fromDirection = toDirection = Vector3.zero;
     storeResult   = Quaternion.identity;
 }
コード例 #36
0
 public override void OnReset()
 {
     variable = Quaternion.identity;
     compareTo = Quaternion.identity;
 }
コード例 #37
0
 public override void OnReset()
 {
     targetGameObject = null;
     rotation         = Quaternion.identity;
 }
コード例 #38
0
 public virtual void OnReset()
 {
     this.variable  = (SharedQuaternion)Quaternion.get_identity();
     this.compareTo = (SharedQuaternion)Quaternion.get_identity();
 }
コード例 #39
0
 public override void OnReset()
 {
     eulerVector = Vector3.zero;
     storeResult = Quaternion.identity;
 }
コード例 #40
0
 public override void OnReset()
 {
     eulerVector = Vector3.zero;
     storeResult = Quaternion.identity;
 }
コード例 #41
0
ファイル: Slerp.cs プロジェクト: dev-celvin/DK
 public override void OnReset()
 {
     fromQuaternion = toQuaternion = storeResult = Quaternion.identity;
     amount = 0;
 }
コード例 #42
0
 public override void OnReset()
 {
     this.targetGameObject = null;
     this.position         = Vector3.zero;
     this.rotation         = Quaternion.identity;
 }
コード例 #43
0
 public virtual void OnReset()
 {
     this.degrees     = (SharedFloat)0.0f;
     this.axis        = (SharedVector3)Vector3.get_zero();
     this.storeResult = (SharedQuaternion)Quaternion.get_identity();
 }
コード例 #44
0
 public override void OnReset()
 {
     this.firstRotation = (this.secondRotation = Quaternion.identity);
     this.storeResult   = 0f;
 }