Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change agent colour during execution #148

Open
douglasbandeiraivo opened this issue Mar 3, 2020 · 2 comments
Open

Change agent colour during execution #148

douglasbandeiraivo opened this issue Mar 3, 2020 · 2 comments

Comments

@douglasbandeiraivo
Copy link

I've seen that I can change some agent attributes like velocity and radius using actions and events, but I didn't find out how to change the agent colour after something happens, for example because of a change of state or because of being in some region of the environment. I tryed to do it changing the agent class inside an event, but it didn't work. Could you tell me how could I do it?

@curds01
Copy link
Collaborator

curds01 commented Mar 4, 2020

Short answer: I've got nothing for you.

Long answer: visualization is a layer on top of agent visualization. In fact, all of the visualization artifacts are in a different library than the core Menge simulation code. Currently, the visualization of agents is hard-coded.

It's been long an intention of mine to make the visualization configurable akin to how the simulation is configured. That's one of the reason that there's a sceneV.xml file. However, currently, the only thing you can configure is camera, lighting, and the like.

However, if you want to hack some code, you can do the following:

  1. The class you want is VisAgent. It draws the little cylinders. Right now the logic for picking a color simply looks at the class id and maps it to a color (in a really, truly, horrible way). If you gut that function you can define an (r, g, b) triple based on any logic you like.

@douglasbandeiraivo
Copy link
Author

douglasbandeiraivo commented Mar 4, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants