All pastes #830584 Raw Edit

Miscellany

public text v1 · immutable
#830584 ·published 2007-12-24 02:09 UTC
rendered paste body
        /*
         * Collision Checking
         */
               
        BoundingCollisionResults results = new BoundingCollisionResults();
        results.clear();
        player.findCollisions(this.getRootNode(), results);
        // results.processCollisions(); // This method does nothing and should be overridden by the user if they want to do anything with it

        if(results.getNumber() > 1)
        {
        	System.out.println("Collision => "+results.getCollisionData(1));
        	this.player.getLocalTranslation().set(this.player.getLastPosition());
        }
        // 1 when the player is not colliding (1 collision is 'the ground' - so this else if only gets entered when moving rather than every interpolation)
        else if (results.getNumber() == 1)
        {
        	this.player.setLastPosition(this.player.getLocalTranslation());
        	System.out.println("Saved new last position ("+results.getNumber()+")");
        }