public void TerrainCollision(PhysicsEngine engine, Vector3 collisionPoint, Vector3 collisionDirection)
 {
     if (collisionDirection == Vector3.Down)
     {
         _onGround = true;
     }
 }
Example #2
0
 public void TerrainCollision(PhysicsEngine engine, Vector3 collisionPoint, Vector3 collisionDirection)
 {
 }
Example #3
0
 private void PhysicsWorker()
 {
     while (NetworkWorkerThread.IsAlive)
     {
         if (nextPhysicsUpdate < DateTime.Now)
         {
             //We need to wait for a login packet to initialize the physics subsystem
             if (World != null && engine == null)
             {
                 // 50 ms / update for 20 ticks per second
                 engine = new PhysicsEngine(World.World, Block.PhysicsProvider, 50);
                 engine.AddEntity(this);
             }
             nextPhysicsUpdate = DateTime.Now.AddMilliseconds(50);
             try
             {
                 engine.Update();
             }
             catch (Exception)
             {
                 // Sometimes the world hasn't loaded yet, so the Phyics update can't properly read blocks and
                 // throws an exception.
             }
         }
         else
         {
             var sleepTime = (nextPhysicsUpdate - DateTime.Now).Milliseconds;
             if (sleepTime > 0)
             {
                 Thread.Sleep(sleepTime);
             }
         }
     }
 }