I'm using the book "Programming Game AI by example" by Mat Buckland(which by the way is a great book and highly recommended) and the example framework defines a trigger as : "A trigger is an object that is activated when an entity moves within its region of influence." Now that region of influence is actually defined as an interface with one single method isTouching which tests to see if an entity is within that region. Regions can be either cyclic or rectangular(cause the framework is in 2D). In a 3D environment the regions shold be spherical or cubic. Now the author uses some 2D math in order to perform these calculations.
Now I was wandering that since jme has built-in collision detection if I could use a BoundingVolume(Sphere or Box) to do this calculation for me especially for the non-visible triggers such as a sound notification? Is this possible or do I have to have an associated Spatial? If I must use a spatial, is there a way to make the spatial non-visible? If the spatial is non-visible will the collision detection still work?
Any other suggestions on how I could best implement this?
Thanks in advance for any replies/suggestions.
Questions answered.
- A spatial can be made non-visible(e.g. spatial.setCullMode(Spatial.CULL_ALWAYS)) and collision detection still works.
- A bounding volume can be used and placed independently of a Spatial.