so i was looking at the hello collision tutorial and i was wondering how i would be able to click on the golem robot and make it disappear. lets say i created that world with two golems, how would you differentiate between the two identical golems? I understand how to do this with geometry shapes, just not spatials.
Edit: So i figured it out. All I have to do is getParent from geometry, which returns the spatial.
[java] if(name.equals("Select")) {
CollisionResults results = new CollisionResults();
Vector2f click2d = inputManager.getCursorPosition();
Vector3f click3d = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 0f).clone();
Vector3f dir = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 1f).subtractLocal(click3d).normalizeLocal();
Ray ray = new Ray(click3d, dir);
charactersNode.collideWith(ray, results);
if (results.size() > 0) {
// The closest collision point is what was truly hit:
CollisionResult closest = results.getClosestCollision();
Spatial temp = closest.getGeometry().getParent();
// System.out.println(temp.getName());
charactersNode.detachChild(temp);
}[/java]
bottom line: don’t jump to the tutorials that seem interesting but do them all from the beginning :roll: