Check if mouse pointer is in spatial region

Hi

If I have a spatial (such a s a sphere) how can I test if the mouse pointer is in spatial region?

BoundigVolume can help me?

You can use colision detection

I use something like that



[java]Vector3f origin = getCamera().getWorldCoordinates(getInputManager().getCursorPosition(), 0.0f);

Vector3f direction = getCamera().getWorldCoordinates(getInputManager().getCursorPosition(), 0.3f);

direction.subtractLocal(origin).normalizeLocal();

Ray ray = new Ray(origin, direction);

CollisionResults results = new CollisionResults();

int number = rootNode.collideWith(ray, results);

if(number > 0) {

CollisionResult closest = results.getClosestCollision();

if(closest.getGeometry() != null) {

pickableNode = closest.getGeometry();

}

} else {

}[/java]



Pit

what is pickableNode ?

Picking

Try working through that tutorial first, it should become clear to you what the node is and how the ray works.



Tip: picklableNode in the example code by @pitoui above is the node containing the object that was picked when the piece of code was ran.

ok ok i foundit it works perfectly thanks