Problem with collision(PhysicsCollisionEvent event)

In this file

I found this code :

public void collision(PhysicsCollisionEvent event) {

if (“Box”.equals(event.getNodeA().getName()) || “Box”.equals(event.getNodeB().getName())) {

if (“bullet”.equals(event.getNodeA().getName()) || “bullet”.equals(event.getNodeB().getName())) {

fpsText.setText(“You hit the box!”);




It seems that “Box” and “bullet” are all Geometries and this code only for comparing/checking these 2 geometries touched to each other.

Can I check one geometry and another object like Node touched/contacted to each other?

For example, I have a cannon ball(geometry) and hero(Node). I want to check cannon ball touches my hero. if touched, then System.out.println(“touched”).

What code can achieve that?