Determining size of Geometry in guiNode

I’d like to attach a Geometry to guiNode and then tell if the user clicks on the geometry. I know how to get the cursor position on the click event and how to determine where the geometry is placed (origin), but I can’t figure out how to tell the extents of the geometry so that I can figure out if the click is inside the x and y of the geometry. The goal is to be able to design a 3D geometry in blender, convert it to a j3o file, attach the geometry from the file to the guiNode, and determine if someone clicks on it without hard coding the min and max of the x / y coordinates.



Is there a way to determine the x and y bounds on the geometry after its been attached to the guiNode?

Why not just do a collision test?



guiNode.collideWith( yourRay, results)

1 Like

I thought about that about 30 min after I posted the question, but for some reason I didn’t think it would work with the guiNode. Don’t ask me why I thought that, but I did.



I’ll try it. Thanks for the response.

Got it working with the Ray:



[java]

Vector2f location = inputManager.getCursorPosition();



Vector3f origin = new Vector3f(location.x, location.y, 0);

Vector3f dir = new Vector3f(0f, 0f, 1f);

Ray ray = new Ray(origin, dir);



CollisionResults results = new CollisionResults();

guiNode.collideWith(ray, results);

[/java]



Thanks again for the response.

1 Like

thx stole this