FlexSim Knowledge Base
Announcements, articles, and guides to help you take your simulations to the next level.

Collision Detection of Bounding Boxes

collisiondetection.gif

Attached is an example model and user library comprising commands to return an array of objects whose bounding boxes intersect, and a Collision Detection object to drop into your model.

The Collision Detection has a ticker interval label to adjust the frequency of checks and will switch the colliding objects to selected. It looks for two groups - "Obstacles" containing static objects in the scene (which may be overlapping and not recorded as collisions) and "Colliders" which are the objects navigating the scene and should be checked for intersecting bounding boxes.

1741087337785.png

In the example model I'm adding the flowitem when it is created using

Group("Colliders").addMember(item)

The detector code is on its FlexScript label, 'analyseScene', which is first scheduled to run by the object's reset trigger.

collisionDetection3.fsm

BBCollisionDetection2.fsl

Attachments
Comments

Super Useful !!!!!

After 180 time units, the red highlights on the colliders doesn't happen sometimes.

Thanks Arun I'll investigate

@Arun Kr I've uploaded new versions which I hope will fix the issue.

This is so helpful, Jason! Thank you for POCing this. Looking forward to more awesome contributions

It's great!!!!

Great job, @jason_lightfoot_adsk !

creative work😀

huangyi0828_0-1762928954707.png

hi @jason_lightfoot_adsk, thanks for your work. could you please further explain the attached code as screenshot? thank again!

@Walker_Huang you can find the code and mathematics used within this implementation here:  Solved: Detect whether there is an obstacle between objects - Autodesk Community

We have noticed some cases where this example implementation fails - at some point we hope to have time to debug and fix those cases.

thank you very much! after going through it, I understand its mathematic principle. truly helpful.