Skip to main content
GameDev.net gamedev.net
🔒 Locked

Irregular shaped obstacles repulsion fields

Started by lucky6969b Feb 15, 2012 at 7:36 PM 3 replies 2.1k views
Original Post
lucky6969b
lucky6969b
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
alvaro
alvaro
You can define the repulsion field as a potential based on distance to the obstacle, regardless of its shape.
jefferytitan
jefferytitan
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.
IADaveMark
IADaveMark
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<
Bedspa
Bedspa
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.