I’m just starting fresh with the JME3 and physics on a new project and just want to check the approach I’m using is the most sensible!
I’ve noticed the Character Control is deprecated, so switched over to the Better Character Control (which I believe is still under-development http://hub.jmonkeyengine.org/forum/topic/bettercharactercontrol-in-the-works/).
In the simple app I’ve got there’s a character and a ghost control, what is the best way to test collision between them.
The approach I’ve got working now is using a Physics Collision Listener testing on the nodes (which in the case of the character is the geometry)
private Node endZone;
private Geometry character;
public void collision( final PhysicsCollisionEvent event )
final Spatial a = event.getNodeA();
final Spatial b = event.getNodeB();
if (isEitherCharacter( a, b ) && isEitherEndZone( a, b ))
fpsText.setText( "Character is in the end zone" );
private boolean isEitherCharacter( final Spatial a, final Spatial b )
return character == a || character == b;
private boolean isEitherEndZone( final Spatial a, final Spatial b )
return endZone == a || endZone == b;
The other option that comes to mind is to compare based on the Physics Collision Object, but as that’s encapsulated in the Better Character Control, currently I’d be need to extend that to provide the needed behaviour. Personally I’d prefer to use the physics object over the node / model as it seems to allow for greater flexibility in application (i.e. switching models but keeping the same control)
So just thought, I’d get some other opinions
The purpose of a ghost control is that it doesn’t collide with anything (hence “ghost”). Use a RigidBody if its supposed to, make it kinematic to not be affected by physics itself. The scene graph is visual, the physics is for collision, not really possible to interchange them?
The content of this post is meant to be read as a straight information or question without an implicit dismissive stance or interest in having the other party feel offended unless there’s emotes that hint otherwise or there’s an increased use of exclamation marks and all-capital words.
Ah …perhaps I’ve missed the context out my post, sorry about that!
The goal is to trigger an event (for my application to respond to) when the player reaches the end zone, not to have any physics / reaction to the player from the end zone.
From the docu (https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:physics_listeners), I’d got the impression that using a ghost and picking up the collision with a physics listener was the way to go, is there a better alternative?
You can check the overlapping objects for the ghost object but its based on the AABB. Generally I’d probably do this based on location though.
Of course the o’ Axis Aligned Bounding Box!
That had completely passed me by, but using the AABB collision detection for an end zone that will be larger then the player shape maybe introduce the possibility of the player’s collision shape being contained completely inside the end zone, with no overlapping manifolds …hmmm will have to try that out later, see if the collision event is still generated.
Anyway using the location is going to be a simpler solution either way!
Thanks for that @normen