예제 #1
0
        protected void Teleport(OpenTK.Mathematics.Vector3 position)
        {
            var pos = position.Convert();

            pos.Y += 0.4f;
            _charController.Warp(ref pos);
        }
예제 #2
0
        public virtual void PlayerMoveRequest(SceneNode sceneNode, Vector3 desiredDisplacement, ref Vector3 pos, bool followTerrain, float timeSinceLastFrame, ref bool dirty)
        {
            if (playerController == null)
            {
                return;
            }


            desiredDisplacement = desiredDisplacement / scaleFactor;
            IndexedVector3 indexedDisplacement = new IndexedVector3(desiredDisplacement);

            playerController.SetWalkDirection(ref indexedDisplacement);

            m_dynamicsWorld.StepSimulation(timeSinceLastFrame / 1000, 3);
            //log.Info("BULLET: completed step simulation");
            UpdateMobPositions();
            TryAddObjects();
            // Get the players current position
            IndexedMatrix worldTransform = playerController.GetGhostObject().GetWorldTransform();

            pos = new Vector3(worldTransform.ToMatrix().M41, worldTransform.ToMatrix().M42, worldTransform.ToMatrix().M43);
            //pos.y -= playerController.Height / 2;
            //pos.y -= playerController.Radius;
            if (pos.Y < 0)
            {
                pos.Y = 0;
                IndexedVector3 indexedPosition = new IndexedVector3(pos);
                playerController.Warp(ref indexedPosition);
            }
            pos = pos * scaleFactor;
        }
예제 #3
0
        public override void ClientResetScene()
        {
            World.Broadphase.OverlappingPairCache.CleanProxyFromPairs(ghostObject.BroadphaseHandle, World.Dispatcher);

            character.Reset(World);
            character.Warp(new Vector3(10.210001f, -2.0306311f, 16.576973f));
        }