# Thread: Have the concept - but need help to express it mathematically (object avoidance)

1. ## Have the concept - but need help to express it mathematically (object avoidance)

Hey there! First off I'm not sure if this is the right forum for this post, it may involve a few disciplines, either way it is beyond me even to know where it belongs, this forum is my best guess other than the "other" forum.

I'm trying to avoid the red object for my 3d space sim/rts project (visit http://www.VoidDestroyer.com if you are interested)

Please look at the attached illustration, I hope it mostly explains the problem.

I cast a ray (a line that tells me what's is in its path - my my game's physics engine) from the starting position to the go to position.

My physics engine tells me the hit point and the normal of the triangle intersected.

My goal is to travel along the normal at the hit point (away from the obstacle), for about a quater of the obstacle's size, then travel perpendicular to the normal for about a quater of the obstacle's size (this is the green line aproximation from the start position), then re-check the ray again.

Problem is: I have no idea how to express this mathemtaically (actual formulas, math involved).

Essencially:
How do I use the normal and the hit position to get a position away from the obstacle in 3D?
When I have that position: How do I use the obstacle's center position, the hit position and size (or whatever else) to determine where to go from there?

I hope I'm not using some terms incorrectly or a faulty method... any help is greatly appreciated.

thank you