Ejemplo n.º 1
0
        public AxisAlignedBoundingBox AABBPhysicsCollisionOnly(AxisAlignedBoundingBox currentAABB, Vector3 moveBy)
        {
            Island closestIsland = islandManager.getClosestIslandToLocation(currentAABB.middle());

            if (closestIsland == null)// if no islands are loaded
            {
                return(currentAABB);
            }
            AxisAlignedBoundingBox newAABB = closestIsland.AABBPhysics(currentAABB, moveBy);


            return(newAABB);
        }
Ejemplo n.º 2
0
        private static void runPhysicsWithMoveActionAndIsland(Actor toMove, Vector3 movement, Island closestIsland)
        {
            Vector3 originalDesiredCharacterAABBMiddle = toMove.getAABB().addVector(movement).middle();


            AxisAlignedBoundingBox newAABBforCharacter = closestIsland.AABBPhysics(toMove.getAABB(), movement);
            Vector3 newVelocity = toMove.getVelocity();

            if (newAABBforCharacter.middle().X != originalDesiredCharacterAABBMiddle.X)
            {
                newVelocity.X = 0;
            }
            if (newAABBforCharacter.middle().Y != originalDesiredCharacterAABBMiddle.Y)
            {
                newVelocity.Y = 0;
            }
            if (newAABBforCharacter.middle().Z != originalDesiredCharacterAABBMiddle.Z)
            {
                newVelocity.Z = 0;
            }
            toMove.setVelocity(newVelocity);
            toMove.setAABB(newAABBforCharacter);
        }