Skip to main content

Temporal behavior of collision detection

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2007-01-08


I am trying to build a simulation using the Java3D geometry-based
collision detection.
To be able to reproduce the spatial state ob my models I rely on
deterministic timing properties of the collision detection.

Thus I registered WakeupOnCollisionExit and WakeupOnCollisionEntry
instances in a custom Behavior.

When moving an object, I expected the WakeupOnCollisionEntry to trigger
the processStimulus(Enumeration) method of the behavior on the next
frame. Which ist not the case.
It seems that processing these WakeupCriterions will only happen, if
there is not again a collision entry or exit on the next frame. If
there is, they seem to be collected.

A little example:

in frame 1 objects are moved so that a collision is made. If the
objects don't move in frame 2, processStimulus will be called in frame
If the collision is removed in frame 2, I will receive 2 notifications
during frame 3 (one CollisionEntry and one CollisionExit)

Can anybody confirm the observed behavior? And is there any way to get
notified on the next frame is the collision state is altered not matter
what happens afterwards?
So far, I am refreshing my object locations only on every other frame,
which obviously helps, but I cannot judge if this makes any noticable
impact on the simulation speed.

Comments are appreciated.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2011-10-13

Collision Detection in Java3D is done after all objects are rendered. If you are "refreshing my object locations only on every other frame" then collision detection will only be done every other frame. Do I understand you correctly? Does that help?