简体   繁体   English

如何在Anylogic 7中推进代理

[英]How to move agent forward in Anylogic 7

Is there any function which can be used in AnyLogic 7 to move agent in a direction (angle) it faces? AnyLogic 7中是否可以使用任何功能来将代理沿其面对的方向(角度)移动? There are methods to move to specific cell, agent and to specific direction (East, West, North, South ...), but how can I move agent forward according angle it faces? 有移动到特定的细胞,活性剂和特定方向(东,西,北,南...)方法,但我怎么能根据它所面临的角度移动agent 转发

Similiar to fd funtction of NetLogo. 与NetLogo的fd类似。

to my knowledge there is no method like: .moveforward() 据我所知,没有像这样的方法:.moveforward()

you could use your current position: .getXYZ() and direction: getRotation() to calculate a point some distance: r, in front of your agent and then use the .moveToStraight(x,y) 您可以使用您当前的位置:.getXYZ()和方向:getRotation()来计算某个距离,该点的距离为:r,位于代理的前面,然后使用.moveToStraight(x,y)

x = r * cos(direction) + x_0 x = r * cos(方向)+ x_0

y = r * sin(direction) + y_0 y = r * sin(方向)+ y_0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM