Closed tristanbob closed 1 year ago
@planktonfun Tagging you in case you are interested in this.
this happens because the decision weight of separation, cohesion, alignment weight are greater than or equal to "move toward object".
you can fix it by increasing "move toward object" decision weight so it can prioritize less emergent movements and more going towards the object movement.
I agree that when my two objects are inside the cohesion radius of each other, the cohesion force will be the same as the "move to target" force (they both use weight =1). However, in my example, the objects fly near each other (inside the cohesion radius) and then continue away (due to momentum). At this point, the cohesion force should not be applying any forces to the objects, so they should head back toward the target object. For some reason, they do not move toward the target object.
I think that the cohesion force is constantly being applied, even after the objects travel outside the cohesion radius. The direction of the force is not being updated (otherwise they would pull together). I'll try to review the code to see if I can find out where the cohesion force is applied and see if it is not being turned off when outside the radius.
Checked the code again, this line is missing:
here's the updated extension with the missing line fix and cohesion fix: BoidsMovement.0.1.6.zip
debug test:
https://user-images.githubusercontent.com/1837825/209092426-6a6ce34a-abcf-4517-b6c1-49bb11492894.mp4
I tested this version and it works great, no cohesion bug! Thanks! Do you want to make a PR for this? If not, I can do it for you.
https://user-images.githubusercontent.com/8879811/209166435-e8fdde5c-830a-4060-9e14-ad59c740618b.mp4
Make PR please, thanks!
Fixed in #704. Thanks @D8H!
Describe the bug of the extension
[Boids] Cohesion force causes Boid objects to lose position awareness and stop heading toward a target object
https://liluo.io/instant-builds/781fd186-b42c-4a61-ba63-c9f7a1d5e547
https://user-images.githubusercontent.com/8879811/208812778-6a566ced-dd65-4bad-ab05-ded36f44a378.mp4
To Reproduce
Steps to reproduce the behavior:
Project files
BoidsCohesionBug.zip
Other details