Beispiel #1
0
        override public void Update(DwarfTime Time, ChunkManager Chunks, Camera Camera)
        {
            base.Update(Time, Chunks, Camera);

            var        pushVector = Vector3.UnitZ;
            Quaternion rot;
            Vector3    scale;
            Vector3    trans;

            GlobalTransform.Decompose(out scale, out rot, out trans);

            pushVector  = Vector3.Transform(pushVector, rot * Quaternion.CreateFromAxisAngle(Vector3.UnitY, -(float)Math.PI / 2.0f));
            pushVector *= (float)Time.ElapsedGameTime.TotalSeconds * 4.0f;

            foreach (var body in Manager.World.EnumerateIntersectingObjects(GetBoundingBox(), CollisionType.Dynamic))
            {
                if (GetBoundingBox().Contains(body.LocalPosition) == ContainmentType.Contains)
                {
                    body.LocalPosition += pushVector;
                }
            }
        }