// turn the player to the specified location
    public Vector3 changeMoveDirection(Vector3 newDirection, bool rotateRight)
    {
        if (turnPlatform[(int)ObjectLocation.Center] != null)
        {
            turnOffset += moveDirection * (turnPlatform[(int)ObjectLocation.Center].turnLengthOffset + localDistance[(int)ObjectLocation.Center]);
        }

        moveDirection = newDirection;

        // don't change move directions if there are still turn objects. It is about to be game over anyway since multiple turns aren't supported this closely
        if (infiniteObjectHistory.getBottomTurnInfiniteObject(true))
        {
            stopObjectSpawns = true;
            return(turnOffset);
        }

        ObjectLocation turnLocation = (rotateRight ? ObjectLocation.Right : ObjectLocation.Left);

        localDistance[(int)ObjectLocation.Center]       = localDistance[(int)turnLocation];
        localSceneDistance[(int)ObjectLocation.Center]  = localSceneDistance[(int)turnLocation];
        localPlatformHeight[(int)ObjectLocation.Center] = localPlatformHeight[(int)turnLocation];
        localSceneHeight[(int)ObjectLocation.Center]    = localSceneHeight[(int)turnLocation];
        turnPlatform[(int)ObjectLocation.Center]        = turnPlatform[(int)turnLocation];
        turnPlatform[(int)ObjectLocation.Right]         = turnPlatform[(int)ObjectLocation.Left] = null;

        // The center objects and the objects in the location opposite of turn are grouped togeter with the center object being the top most object
        for (int i = 0; i < 2; ++i)
        {
            InfiniteObject infiniteObject = infiniteObjectHistory.getTopInfiniteObject((turnLocation == ObjectLocation.Right ? ObjectLocation.Left : ObjectLocation.Right), i == 0);
            // may be null if the turn only turns one direction
            if (infiniteObject != null)
            {
                InfiniteObject centerObject = infiniteObjectHistory.getBottomInfiniteObject(ObjectLocation.Center, i == 0);
                infiniteObject.setInfiniteObjectParent(centerObject);
            }
        }

        infiniteObjectHistory.turn(turnLocation);

        if (turnPlatform[(int)ObjectLocation.Center] != null)
        {
            setupPlatformTurn();
        }

        return(turnOffset);
    }