Irregular shaped obstacles repulsion fields

Started by
3 comments, last by Bedspa 12 years, 2 months ago
How do I setup a repulsion field from obstacles that have irregular shapes?
My first thought was to use a bounding box and use its half-radius to calculate.
What is your comment?
Thanks
Jack
Advertisement
You can define the repulsion field as a potential based on distance to the obstacle, regardless of its shape.
Do you just want A repulsion field, or one that matches the shape of the object? If just any old field would work, a bounding box or spherical field would be fine.

For something that matches the shape of the object more, maybe have a minimal bounding box to prevent clipping, but also do a few raycasts on the geometry to estimate the closest point. Then repulse based on the closer of the raycasts minus the minimum approach distance or the minimal bounding box. This means the repulsion field of certain bits of the geometry may stick out beyond the bounding box.
I would agree that it might be more efficient to use a distance-based, per-agent approach (i.e. with collision raycasts) than to calculate and pre-bake a repulsion field.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

One trick I've found useful at times for creating collisions or physics effects on irregular objects without turning on per triangle collisions was to just child several small collision boxes to the main object. As long as this object is not being affected by it's own irregular shape this works very well and is usually efficient code wise.

If the object has to react physically because of it's irregular shape (for example our repulsion field is attached to half bum bell like shape and has to roll/bounce down a hill while repulsing) then the only clean solution is to create a collision mesh.

Is your fields repulsion strength based on distance or simply on collision? If on distance, you might want to create two or more repulsion nodes that add up each others repulsion vector. That way a peanut shaped repulsion field will not be weaker if you bump into the ends compared to the middle.

This topic is closed to new replies.

Advertisement