Rotate the turtles's headings to the right of angle degrees.

right(turtles, angle)

# S4 method for agentMatrix,numeric
right(turtles, angle)

Arguments

turtles

AgentMatrix object representing the moving agents.

angle

Numeric. Vector of angles in degrees by which to rotate the turtles' headings. Must be of length 1 or of length turtles.

Value

AgentMatrix representing the turtles with updated heading values.

Details

If a given angle value is negative, then the turtle rotates to the left.

References

Wilensky, U. 1999. NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.

Author

Sarah Bauduin

Examples

w1 <- createWorld(minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4)
t1 <- createTurtles(n = 10, world = w1)
of(agents = t1, var = "heading")
#>  [1] 147.17481  28.50498 188.62080 164.09836 106.26937  20.80694 265.68933
#>  [8] 130.64239 110.76797 147.98420
t1 <- right(turtles = t1, angle = 180)
of(agents = t1, var = "heading")
#>  [1] 327.174813 208.504983   8.620805 344.098363 286.269369 200.806941
#>  [7]  85.689325 310.642390 290.767968 327.984195