Exemple #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);
        }
 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);
 }
 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);
 }
Exemple #4
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;
 }
Exemple #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;
 }
Exemple #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;
 }
 public virtual void OnReset()
 {
     this.fromDirection = this.toDirection = (SharedVector3)Vector3.get_zero();
     this.storeResult   = (SharedQuaternion)Quaternion.get_identity();
 }
Exemple #8
0
 public override void OnReset()
 {
     targetGameObject = null;
     position = Vector3.zero;
     rotation = Quaternion.identity;
 }
Exemple #9
0
 public override void OnReset()
 {
     targetGameObject = null;
     rotation = Quaternion.identity;
 }
 public virtual void OnReset()
 {
     this.targetGameObject = (SharedGameObject)null;
     this.storeValue       = (SharedQuaternion)Quaternion.get_identity();
 }
Exemple #11
0
 public override void OnReset()
 {
     targetGameObject = null;
     storeValue       = Quaternion.identity;
 }
Exemple #12
0
 public override void OnReset()
 {
     this.targetValue    = Quaternion.identity;
     this.targetVariable = Quaternion.identity;
 }
 public override void OnReset()
 {
     targetQuaternion = storeResult = Quaternion.identity;
 }
 public override void OnReset()
 {
     this.forwardVector = Vector3.zero;
     this.storeResult   = Quaternion.identity;
 }
 public virtual void OnReset()
 {
     this.storeResult = (SharedQuaternion)Quaternion.get_identity();
 }
 public override void OnReset()
 {
     firstRotation = secondRotation = Quaternion.identity;
     storeResult   = 0;
 }
 public override void OnReset()
 {
     this.fromDirection = (this.toDirection = Vector3.zero);
     this.storeResult   = Quaternion.identity;
 }
Exemple #18
0
 public virtual void OnReset()
 {
     this.fromQuaternion = this.toQuaternion = this.storeResult = (SharedQuaternion)Quaternion.get_identity();
     this.amount         = (SharedFloat)0.0f;
 }
Exemple #19
0
 public override void OnReset()
 {
     degrees     = 0;
     axis        = Vector3.zero;
     storeResult = Quaternion.identity;
 }
 public override void OnReset()
 {
     targetValue = Quaternion.identity;
     targetVariable = Quaternion.identity;
 }
Exemple #21
0
 public override void OnReset()
 {
     leftRotation = rightRotation = Quaternion.identity;
     storeResult  = 0;
 }
Exemple #22
0
 public override void OnReset()
 {
     firstRotation = secondRotation = Quaternion.identity;
     storeResult = 0;
 }
 public override void OnReset()
 {
     this.variable  = Quaternion.identity;
     this.compareTo = Quaternion.identity;
 }
Exemple #24
0
 public override void OnReset()
 {
     this.leftRotation = (this.rightRotation = Quaternion.identity);
     this.storeResult  = 0f;
 }
Exemple #25
0
 public override void OnReset()
 {
     this.fromQuaternion  = (this.toQuaternion = (this.storeResult = Quaternion.identity));
     this.maxDeltaDegrees = 0f;
 }
Exemple #26
0
 public override void OnReset()
 {
     fromQuaternion = toQuaternion = storeResult = Quaternion.identity;
     maxDeltaDegrees = 0;
 }
Exemple #27
0
 public override void OnReset()
 {
     fromDirection = toDirection = Vector3.zero;
     storeResult = Quaternion.identity;
 }
Exemple #28
0
 public override void OnReset()
 {
     degrees = 0;
     axis = Vector3.zero;
     storeResult = Quaternion.identity;
 }
Exemple #29
0
 public override void OnReset()
 {
     storeResult = Quaternion.identity;
 }
Exemple #30
0
 public override void OnReset()
 {
     leftRotation = rightRotation = Quaternion.identity;
     storeResult = 0;
 }
Exemple #31
0
 public override void OnReset()
 {
     targetGameObject = null;
     storeValue = Quaternion.identity;
 }
Exemple #32
0
 public override void OnReset()
 {
     this.targetQuaternion = (this.storeResult = Quaternion.identity);
 }
Exemple #33
0
 public override void OnReset()
 {
     fromQuaternion = toQuaternion = storeResult = Quaternion.identity;
     amount         = 0;
 }
Exemple #34
0
 public override void OnReset()
 {
     this.degrees     = 0f;
     this.axis        = Vector3.zero;
     this.storeResult = Quaternion.identity;
 }
 public override void OnReset()
 {
     fromDirection = toDirection = Vector3.zero;
     storeResult   = Quaternion.identity;
 }
 public override void OnReset()
 {
     variable = Quaternion.identity;
     compareTo = Quaternion.identity;
 }
 public override void OnReset()
 {
     targetGameObject = null;
     rotation         = Quaternion.identity;
 }
 public virtual void OnReset()
 {
     this.variable  = (SharedQuaternion)Quaternion.get_identity();
     this.compareTo = (SharedQuaternion)Quaternion.get_identity();
 }
 public override void OnReset()
 {
     eulerVector = Vector3.zero;
     storeResult = Quaternion.identity;
 }
 public override void OnReset()
 {
     eulerVector = Vector3.zero;
     storeResult = Quaternion.identity;
 }
Exemple #41
0
 public override void OnReset()
 {
     fromQuaternion = toQuaternion = storeResult = Quaternion.identity;
     amount = 0;
 }
Exemple #42
0
 public override void OnReset()
 {
     this.targetGameObject = null;
     this.position         = Vector3.zero;
     this.rotation         = Quaternion.identity;
 }
 public virtual void OnReset()
 {
     this.degrees     = (SharedFloat)0.0f;
     this.axis        = (SharedVector3)Vector3.get_zero();
     this.storeResult = (SharedQuaternion)Quaternion.get_identity();
 }
Exemple #44
0
 public override void OnReset()
 {
     this.firstRotation = (this.secondRotation = Quaternion.identity);
     this.storeResult   = 0f;
 }