   Moving game entities in an organic fashion
  Here is my problem: I have a bunch of objects in my game and they have really simple ai. The ai is find a random position (xyz), and go there, once they are there, find a new position and travel there. Right now they are comparing their current position with the target, getting the angle in between and traveling their velocity to the target. To get this project done, I have to get them to move in an organic way, such as once the target has been reached, keep going in the same direction and turn to the new target instead of immediately changing rotation and traveling there. I have created a little image of what I need them to do, but I am stuck on how to do it in 3 dimensions. http://photobucket.com/albums/c305/biohaz1/?action=view&current=smoothcurves.gifI am using direct x for the project.Thanks.   
  Simply give them a maximum angular velocity, just as they have a maximum linear velocity. Each frame, they turn towards their target point, but no more than physically possible, given the timestep and their maximum angular velocity. Then they move forwards.   ;  ... and make the angle relative to the speed, else you get slowmoving objects which have to make huge turns, not really whatyou want because your entities will get stuck :)   ;  Yea, I thought about doing this, but what if the next position is too close for the object to turn to? It will miss it and go around in circles. I was thinking about something parametric that would go out to be sure to hit the next target. Or will the method of max angles work even at low distances?   ;Quote:Original post by biohazYea, I thought about doing this, but what if the next position is too close for the object to turn to? It will miss it and go around in circles.You can detect this condition and have it rotate in place.   ;Quote:Original post by SneftelSimply give them a maximum angular velocity, just as they have a maximum linear velocity. Each frame, they turn towards their target point, but no more than physically possible, given the timestep and their maximum angular velocity. Then they move forwards.Do you mean to say, maximum Torque and maximum Acceleration?Objects (Einstein's Relativity stuff aside) do not have maximum velocities; they can keep accelerating to increase their velocity, it is only the rate of increase that is limited. (I am assuming since this is a 3d question this takes place in Space where wind resistance is not a factor.)If you take physics into account in your game, and give your Objects realistic means of movement - accelerations instead of instant angle and velocity changesthen the curved paths you want should emerge naturally.'Arcade' style physics leads to arcade style motion   ;  Could you use a spline?   ;Quote:Original post by haphazardlynamedDo you mean to say, maximum Torque and maximum Acceleration?No. (It would be more correct to talk either about maximum torque and force, or maximum angular acceleration and maximum (linear) acceleration). But no, I'm assuming that both can be arbitrarily high. This is for two reasons: (1) maximum torque does tend to be surprisingly high, to the extent that making it infinite doesn't look too bad; and, (2), if you want to do a full dynamics solution like that, you pretty much need to get into PD controllers, which are a royal pain in the butt to make robust in exact goal-seeking conditions. The method of having a maximum angular velocity and no maximum angular acceleration is not precisely physically correct, but it's a very good compromise between perceived realism and computational complexity.   ;  K then,On that note... Can you tell more about using physics simulation and PD controllers?There is a similar topic here: http://www.gamedev.net/community/forums/topic.asp?topic_id=361067which goes more in that direction, and I'm curious as well about how to do it with that method(s). Input would be appreciated.   ;  I had the same problem once, when trying to build a guided missile engine.I solved it using a simple Bezier function (there are like 3 or 4 formulas there, depending if you use 2D or 3D). IT'S EASY! I used 3 points to get the curve:first  - the current position of my missile;second - the last target's positionlast   - the current target's positionThis way, my missile will allways follow the target in a VERY ORGANIC way [smile]. I would share that code here, but I lost it a long time ago... but if you like the method I can give you those formulas from a book (which, ofcourse, I don't have it right now - I'm at work [sad])PS: Don't wanna be rude, but that "Torque and maximum Acceleration" is crap! We're doing game engines here, not nuclear engines [lol]!WE ONLY NEED THE SIMPLEST SOLUTION THAT COULD POSSIBLY WORK.