BehaviourComposer: ignore everything before this.
Begin micro-behaviour:
Begin description: Turn towards another agent or a patch. End description
Turn towards another
Begin NetLogo code:
substitute-text-area-for expression-for-other anyone substitute-text-area-for turn-expression desired-turn let desired-heading heading-towards-another expression-for-other let desired-turn desired-heading - my-heading turn-right turn-expression
End NetLogo code
The contents of the first text area represents the agent or patch that the agent running this behaviour should turn towards. You can replace it an expression such as any-of-kind "Prototype1". You may want to introduce a maximum turning speed by replacing desired-turn with within-range canonical-heading desired-turn -30 30 (this makes the angle turned be between -30 and 30).
You can enhance this behaviour to repeatedly turn towards the other.
This computes the angle from where the agent is to the other. The agent turns towards the other by the difference between my desired-heading and my-heading. It uses heading-towards-another to compute the angle.
Repeatedly go forward in the direction of my heading can be used together with a repeating version of this to move towards another. Turn towards location turns towards a specified location instead of an agent or patch. There are many movement behaviours in the main library.
Turn towards another was implemented by Ken Kahn
BehaviourComposer: ignore everything after this.