need help in obstacle avoidance math
i'm writing a script for character that will be able to avoid obstacles.
the target is set on mouse click and in Update it is moving to the target.
i have a trigger sphere on it. and obstacles have colliders on them.
so on TriggerStay i've managed to understand how to get nearest point of collision (other.ClosestPointOnBounds(transform.position)) and direction vector by substracting char position from contact point. but i can't understand how to correct character position, so it is somewhat deflected from wall smoothly while continue to move to target.
the best what i came to is calculating normal with Cross between forward vector and direction of contact and then calculating Dot product between forward direction and this normal vector. this gives a value with sign, but i can't understand how to use it. may be it is totaly wrong approach?
Answer by PedroDev · Mar 25, 2016 at 04:04 PM
You can use RAIN AI System ( https://www.assetstore.unity3d.com/en/#!/content/23569 ) that can make navmesh at runtime .. BUT Does not support Dinamic obstacle avoidance :/
Answer by snair692 · Mar 21, 2016 at 08:09 PM
Why not use a Navigation Mesh and a Navigation Mesh Agent?
Your answer
Follow this Question
Related Questions
How to move an object without impacting it's natural gravitational behavior 1 Answer
Player keeps bumping when walking over to another sprite 1 Answer
Move object without leaving bounds 0 Answers
C# Unity Move the player along a* found path 0 Answers
Choose random point within an angular field of view 0 Answers