VL - Interactive Agents hitdetection

hi all,

starting from the interactive agents in the schnellebuntebilder tutorial, I want to implement the functionality that agents check if they collide with another agent, and then change velocity and decrease their lightness.


am I right to implement that funktion in the agent itself?

If I let it check against all agent positions, the agent will always “hit itself”, so I have to filter out its own position. foreach with keep would be nice, but since the pads work as framedelay the position if always a little off.

valuewithinRange takes no vector2, or I could use rectContainsPoint, or If > AND < than agent position ± threshold.

Is there a cleaner way to do this?

if you want to do hit detection of each agent with all others, it’s better to make a third patch CollisionManager that has knowledge about the whole ‘agent world’. it would get all agents and can manage them accordingly. the agent can still have a member operation CollideWithOtherAgent that has inputs for position/size of the other agent and specific functionality about behavior. you can use this member operation in the CollisionManager.

ah, I’m starting to get it… like in the connectAll video.


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.