Beispiel #1
0
 private void mount()
 {
     if (!_enable || hasChanged())
     {
         Transform           point = this.getMountPoint();
         Yggdrasil.WorldPose wp    = Yggdrasil.AsgardToWorld(this.asgardPose_, point);
         Transform           tsfm  = this.getTransform();
         tsfm.position = wp.position;
         tsfm.rotation = Quaternion.LookRotation(wp.forward, wp.up);
         tsfm.setGlobalScale(wp.scale);
         _enable = true;
     }
 }
Beispiel #2
0
        /*
         * public void setupMark(TransformData data) {
         *  data.write(ref _mark, TransformData.Type.Local);
         * }*/
        public void setup(Transform hero, Transform qrmark)
        {
            Yggdrasil.AsgardPose ap = Yggdrasil.WorldToAsgard(new Yggdrasil.WorldPose(Yggdrasil.Instance.transform), hero);


            this.transform.position = qrmark.position;
            this.transform.rotation = qrmark.rotation;


            Yggdrasil.WorldPose wp = Yggdrasil.AsgardToWorld(ap, this.transform);
            this.transform.position = wp.position;
            this.transform.rotation = Quaternion.LookRotation(wp.forward, wp.up);
        }
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 Update()
        {
            if (Yggdrasil.Instance.hasChanged)
            {
                Debug.Log(_data.asgardPosition);
                Yggdrasil.WorldPose wPose = Yggdrasil.Instance.getWorldPose(new Yggdrasil.AsgardPose(_data.asgardPosition, _data.asgardRotation, _data.asgardScale));

                this._transform.setGlobalScale(wPose.scale);
                this._transform.position = wPose.position;
                this._transform.rotation = wPose.rotation;
            }
            if (amIGod && hasChanged)
            {
                synchro();
                hasChanged = false;
            }
        }
Beispiel #5
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;
                }
            }
        }
Beispiel #6
0
        private void Update()
        {

            if (isLocalPlayer)
            {
                transform.position = Camera.main.transform.position;
                transform.rotation = Camera.main.transform.rotation;

                Yggdrasil.AsgardPose aPose = Yggdrasil.Instance.getAsgardPose(new Yggdrasil.WorldPose(this.transform));
                CmdTransform(aPose.asgardPosition, aPose.asgardRotation);
              


            }
            else
            {
                Yggdrasil.WorldPose wPost = Yggdrasil.Instance.getWorldPose(new Yggdrasil.AsgardPose(asgardPosition, asgardRotation, Vector3.one));
                transform.position = Vector3.Lerp(transform.position, wPost.position, 0.3f);
                transform.rotation = wPost.rotation;
            }
        }