Jump to content

[SOLVED] I need to measure the distance between two objects


photo

Recommended Posts

Posted

Hi

I need to measure the distance between two objects

 

I want to shoot a ball to the target and when ball close to the target, The target destroyed.

-----

Note: the target object is moving
I can not use contact callback.

Posted

You can try out one of the following variants:

  1. Use on of engine.world.getIntersection* ray-tracing functions (there a re different implementations with filters, etc.). After that, calculate the distance based on a vector via length().
  2. Much more simpler variant is to use PhysicalTrigger. Make it a child node of the target, and each time a ball will come close, a callback will be fired.
×
×
  • Create New...