ricardojmendez / UnitySteer

Steering, obstacle avoidance and path following behaviors for the Unity Game Engine
https://numergent.com/tags/unitysteer/
Other
1.2k stars 275 forks source link

Using cohesion but keeping minimum distance apart #38

Open grofit opened 8 years ago

grofit commented 8 years ago

Sorry to post on unity answers and here but it seems like you don't visit unity answers much anymore.

I had a quick question about handling some simple form of weighted local avoidance:

http://answers.unity3d.com/questions/1040634/using-cohesion-but-keeping-minimum-distance-apart.html

whiteGhost333 commented 8 years ago

In my example, I am using AStar. I have an event where I a cluster (call it a tank platoon). The terrain is far from a flat plane. I project several points on the terrain using a fixed formation structure. It can be altered but in this instance. Given the independent calculation of the unique paths, I choose not to repath based upon potential collision. This is a large RTS with 3rd person render detail. Repath would require a Cray Research machine. I suggest the idea of traffic safety. Alter the objects velocity or speed based on a collision trigger zone and resume speed upon. It actually has an interesting animation effect by reducing apparent robotic behavior when, in effect, it is precisely that. What vector velocity is your own choosing. Yours has 3 apparently. On Sep 4, 2015 7:36 AM, "LP" notifications@github.com wrote:

Sorry to post on unity answers and here but it seems like you don't visit unity answers much anymore.

I had a quick question about handling some simple form of weighted local avoidance:

http://answers.unity3d.com/questions/1040634/using-cohesion-but-keeping-minimum-distance-apart.html

— Reply to this email directly or view it on GitHub https://github.com/ricardojmendez/UnitySteer/issues/38.

grofit commented 8 years ago

I am not so much after a fixed formation, it would be used within a space environment so I just basically want to try and reduce ships smashing into each other, so from a high level it seems like all I need to do is work out any entities within a distance as you mention then work out a distance away from them and factor that into the weighting.

Now that all being said, I am new to UnitySteer, I have played with the examples (as shown in the screenshot in the unity answers thread) so I am not entirely sure the best way to go about doing this, I was part hoping someone had already done something similar so I didn't need to re-invent the wheel.

whiteGhost333 commented 8 years ago

I wouldn't fixate on the fixed formation. At any instant in time, your follow function is enabled by a fixed point in space. It of course pop someplace else in the next frame, but, unless we're dealing with the double slit experiment, it is only in one location. In my viewpoint, continuous recalculate on of any sort should be avoided if involves many game objects. The perpetual recalculate only yields a usable solution maybe 1 in a 1000 times. Event triggers were my choice but they might not be best suited to your situation. On Sep 6, 2015 10:30 AM, "LP" notifications@github.com wrote:

I am not so much after a fixed formation, it would be used within a space environment so I just basically want to try and reduce ships smashing into each other, so from a high level it seems like all I need to do is work out any entities within a distance as you mention then work out a distance away from them and factor that into the weighting.

Now that all being said, I am new to UnitySteer, I have played with the examples (as shown in the screenshot in the unity answers thread) so I am not entirely sure the best way to go about doing this, I was part hoping someone had already done something similar so I didn't need to re-invent the wheel.

— Reply to this email directly or view it on GitHub https://github.com/ricardojmendez/UnitySteer/issues/38#issuecomment-138102763 .