I’m working on implementing a line of sight/vision cone in Anylogic and I’ve hit a couple roadblocks. My primary question is how to get agents to provide contacts with a node inside another agent, but I’ll also show the other attempts I tried and gave up on in case those have more merit.
My “Teacher” agent has a ‘los’ cone to represent it’s field of view. I have restrictions on and applied to “Student”. On enter, students should be added to ‘losTargets’. On exit, they should be removed from ‘losTargets’. However, they don’t seem to ever enter or exit because they aren’t interacting with the node at all. My hypothesis is that because los is within Teacher, the students in Main cant interact with it. Is there a way to make them interact?
Pallet view of Teacher
Properties of los
Another implementation I tried was finding all students in a range, then detecting if the position of those students was inside the vision cone using los.contains(student.getX(), student.getY). This also could not detect the students, and after consulting the Anylogic Help page I believe it’s because ‘contains’ only checks the node’s vertices. It could also be that the node is in local space (relative to teacher) whereas the students are in global space (relative to main). If this is the issue, I’m not sure how to fix that. If this implementation has more merit and is worth pursuing I can break it off into a new question, but in this case it’s mostly provided for context.
Properties of losGetTarget – manually checking for students in range
I looked into these two stackoverflow questions prior to posting but they didn’t prove very helpful.
How can I communicate with another agent (anylogic) within certain vision angle?
How can I get node restrictions applied in an agent type’s interface to take effect in the main agent when I run the model?
user26618530 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.