Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

Irregular shaped obstacles repulsion fields

This topic is 2492 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
You can define the repulsion field as a potential based on distance to the obstacle, regardless of its shape.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!