Esempio n. 1
0
 public void Reset()
 {
     _physics._rigidBody.LinearVelocity  = Vector3d.Zero;
     _physics._rigidBody.AngularVelocity = Vector3d.Zero;
     SetRotation(Globals.LocalUpRotation());
     _physics.SetRotation(Globals.LocalUpRotation());
 }
Esempio n. 2
0
        public void LookAt(Vector3d p)
        {
            if (p.Equals(transform.Position))
            {
                p += Vector3d.UnitZ;
            }
            MPhysicsObject po = (MPhysicsObject)FindModuleByType(EType.PhysicsObject);

            //Matrix4d mat = Matrix4d.LookAt(this.transform.Position , p , Vector3d.UnitY);
            Quaterniond q = Extensions.LookAt(this.transform.Position, p, Vector3d.UnitY);

            if (po != null)
            {
                po.SetRotation(q);
            }
            transform.Rotation = q;
        }
Esempio n. 3
0
        public void SetRotation(Quaterniond q, bool NotifyDescendents = true)
        {
            MPhysicsObject po = (MPhysicsObject)FindModuleByType(EType.PhysicsObject);

            if (po != null)
            {
                po.SetRotation(q);
            }
            else
            {
                transform.Rotation = q;
            }

            if (NotifyDescendents == true)
            {
                ParentChanged();
            }
        }
Esempio n. 4
0
        public override void Update()
        {
            if (Enabled == false)
            {
                return;
            }
            MSceneObject so = (MSceneObject)Parent;

            if (so != null)
            {
                Quaterniond q = so.transform.Rotation * AngleOffset;
                so.transform.Rotation = Quaterniond.Slerp(so.transform.Rotation, q, Time.DeltaTime * Speed);
            }
            if (_physics != null)
            {
                _physics.SetRotation(so.transform.Rotation);
            }
        }
Esempio n. 5
0
        public void SetRotation(Quaterniond q, bool NotifyDescendents = true)
        {
            //a phyics module may be added at any time, so we need to query for it
            MPhysicsObject po = GetPhysics();

            if (po != null)
            {
                _physics.SetRotation(q);
            }
            else
            {
                transform.Rotation = q;
            }

            if (NotifyDescendents == true)
            {
                ParentChanged();
            }
        }