Skip to main content

Collisions between objects in differenct locales

Please note these forums are being decommissioned and use the new and improved forums at
2 replies [Last post]
Joined: 2011-01-26

Will WakeupOnCollisionMovement() processStimulus() be called if the two 'colliding' objects are attached to differenct locales?


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-06-07


unfortunately, no!

As I never tried it before and the Java 3D specs, books, etc. don't give any hints about this subject I adapted the Java 3D sample program 'org.jdesktop.j3d.examples.collision.TickTockCollision'.

At first, I created a second Locale instance with a slightly different HiResCoord and added one of the two objects and the corresponding CollisionDetector-Behavior to its BranchGroup. The flying cube in the first Locale still hit this object but no collision was signaled.

Secondly, I created a second CollisionDetector-Behavior instance and added this one also to the first Locale. Now a collision was signaled but before the flying cube hit the object.

After checking the internal sources my conclusions are:

- A WakeupOnCollisionXXX criterion is tested only against objects in the Locale of its corresponding Behavior.
- A collison test doesn't take into account the spherical offset due to the Locale's HiResCoord.

Typically different Locales are chosen if sub-scenes have distances above the value range of single-precision floating-point values.

If your Locales' volumes do intersect and the objects can really collide would it be feasible to add all these objects into one Locale?


Joined: 2011-01-26

Many thanks for the confirmation. I too have made a few 'experimental' scenes, to no avail: no collisions apparent between objects in different locales.
Also unfortunately, many of my scene objects are the definition of 'widely moving' and require periodic 're-attaching' to different Locales. I was going to use collisions to 'sense' which Locale to attach to. I however have a 'work around' in place, not involving J3D collision detection.
Once again, many thanks for the information.