WRS
it was a little more complicated than I expected when there were multiple patrol objects and lots of triggers. In my sample, patrols move until they hit a trigger, they then turn until they match the angle of the trigger, then start moving again.
If a trigger is set to an angle of 90 degrees, C2 sometimes thought it was a small fraction off (like 90.00002), so you have to round the angles before comparing.
I also ran into trouble when multiple patrols were overlapping triggers at the same time - you have to make sure you are comparing to the correct trigger.
then, if the difference in direction is more than 180 degrees, you probably want to turn the shorter direction, so in that case the patrol turns -5 degrees.
you can get my sample here:
https://www.rieperts.com/games/forum/patrol.capx
EDIT: one important note is that, obviously, if the patrol is turning 5 degrees (or -5 degrees) per tick, then you have to make sure the angle of the trigger is a multiple of 5 - otherwise the angle of the patrol will never match up with the angle of the trigger and it will just spin around on the trigger forever...
AllanR
hey, in your example when the angle of the object changes from 180 to 270 degrees it doesn't rotate in -2.5 degrees
please do have a look at the capx file i am attaching below
drive.google.com/file/d/1C0TmW-rNAlTtwJZwlciZyRpOUj0ho_kd/view