algorithm - On the edge of 0 and 360 degrees (or radians -PI and PI) -
i have little demo in processing of circular repulsion. works great except moment when object , repulsor (mouse) have degrees close 360 | 0 zone (or pi | -pi ).
or youtube video
it's 100% because of transition, don't have idea how overcome it. have played modulo.
at first - hope don't mix radians , degrees in comparisons.
your calculation
float angledist = abs(angle - repulsor.angle); , later comparison inc=45 degrees works wrong if 1 angle 359 , and 1, example.
you can build if-conditions or use expression:
angledist = arrcos(cos(angle - repulsor.angle)); that treats cases correctly

Comments
Post a Comment