How can we change 3D animation object (agents representation) color based on statechart?

混江龙づ霸主 提交于 2021-01-29 16:12:28

问题


I have a person agent who has a 3D representation of a man (default 3D pic of a human from anylogic). Can we change color of that 3D person agent's representation based on states? For example, when a agent moves from state A to B, it will change color from yellow to red. How to do that? I tried with shapeFillColor but anylogic is not detecting that 3D human representation as a shape (like polygons, triangle), statechart is not taking my command. Is it like we can only change the agent's color if that agent is manually drawn with some polygon? Will appreciate any feedback. Thanks,

agent's 3D representation


回答1:


You can do it as follows, it is not 100% intuitive:

  1. Check your 3D model properties and note the material names (for example "Material__6__Surf" --> NOTE: it has 2 underscores before and after the number!!)
  2. At runtime, simply call worker.setColor("Material__6__Surf", red); and the respective color will change (in this case the trousers)


来源:https://stackoverflow.com/questions/61903858/how-can-we-change-3d-animation-object-agents-representation-color-based-on-sta

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!