   Obstacle Avoidance
  Hey.Im doin obstacle avoidance. In a 3D world but movement restricted to x and z. I can find which obstacle is closest no problem. But what i dont know is how to calculate the avoiding vector. Can anyone help me?Edit: Sorry left the method out. To find obstacles i just get the characters velocity, normalize it and multiply it by some detection value, 5 in this case. Then I do, where startPt is the characters Position.:currentPt = startPt + (rayVector * index);and check if the ray is within the radius of any obstacle. If it is i check if it is closer than the previously stored nearest obstacle (for the first run the nearest obstacle is set to the max for a float so any close obstacle will become the closest). Then i increase index by 0.5 and check again upto 5.   
  Can you tell us more about your game? Generally, you want to use some kind of pathfinding algorithm, such as the A* (Googling hint: "A star") algorithm. Trying to avoid only the closest obstacle could potentially put the actor in a worse place from which to reach their goal.   ;  Pathfinding isnt an option here. the game is a third person, simple stealth puzzle game. So if the player is seen the guards chase you. Thats where i need it, when the guards are chasing the player, they need to be able to dodge objects around the world. A* wont work for that.   ;  Is this what you are looking for?   ;  I was working off the OpenSteer code by Reynolds, but his way doesnt seem to work for me.He has:const Vec3 offset = position() - nearest.obstacle->center;avoidance = offset.perpendicularComponent (forward());avoidance = avoidance.normalize ();avoidance *= maxForce ();avoidance += forward() * maxForce () * 0.75;ANyone by any chance familiar with this code. I have had to make changes for it to be used in mine. Instead of using forward(), as i dont keep track of i use the characters velocity. instead of maxForce i have the characters max acceleration. Does this sound right to people.   ;Quote:Original post by alvaroIs this what you are looking for?Beat me to it, my friend. Always check out Craig Reynolds stuff for steering stuff, folks.   