Beispiel #1
0
 public void Update()
 {
     if (from_ != null && to_ != null && to_.hasChanged)
     {
         if (!VectorExtensions.CloseEnough(to_.position, from_.position, 0.05f) || !QuaternionExtensions.AlignedEnough(to_.rotation, from_.rotation, 3.0f))
         {
             TweenTransformData.Begin(from_.gameObject, 0.1f, new TransformData(to_.position, to_.rotation, from_.lossyScale));
         }
         to_.hasChanged = false;
     }
 }
Beispiel #2
0
 private void doPose(Yggdrasil.AsgardPose pose)
 {
     if (!_model.controler)
     {
         Yggdrasil.WorldPose world = Yggdrasil.Instance.getWorldPose(pose);
         if (Vector3.Distance(world.position, target.position) < 0.3f)
         {
             TweenTransformData.Begin(target.gameObject, 0.03f, new TransformData(world.position, Quaternion.LookRotation(world.forward, world.up), world.scale));
         }
         else
         {
             target.position = world.position;
             target.rotation = Quaternion.LookRotation(world.forward, world.up);
             target.setGlobalScale(world.scale);
         }
     }
 }
Beispiel #3
0
 private void dataChange(Yggdrasil.AsgardPose oldValue, Yggdrasil.AsgardPose newValue)
 {
     if (!this.hasAuthority)
     {
         Yggdrasil.WorldPose world = Yggdrasil.Instance.getWorldPose(newValue);
         if (_interpolation && Vector3.Distance(world.position, getTransform().position) < 0.3f)
         {
             TweenTransformData.Begin(getTransform().gameObject, 0.1f, world.position, Quaternion.LookRotation(world.forward, world.up), world.scale);
         }
         else
         {
             getTransform().position = world.position;
             getTransform().rotation = Quaternion.LookRotation(world.forward, world.up);
             getTransform().setGlobalScale(world.scale);
         }
     }
 }
Beispiel #4
0
        void dataChange(Data data)
        {
            _data = data;
            if (!amIGod)
            {
                Yggdrasil.WorldPose wPose = Yggdrasil.Instance.getWorldPose(new Yggdrasil.AsgardPose(_data.asgardPosition, _data.asgardRotation, _data.asgardScale));

                if (_interpolation && Vector3.Distance(wPose.position, this.transform.position) < 0.3f)
                {
                    TweenTransformData.Begin(_transform.gameObject, 0.1f, wPose.position, wPose.rotation, wPose.scale);
                }
                else
                {
                    this._transform.setGlobalScale(wPose.scale);
                    this._transform.position = wPose.position;
                    this._transform.rotation = wPose.rotation;
                }
            }
        }