Vehicle slowly turning to Destination
Blitz3D Forums/Blitz3D Beginners Area/Vehicle slowly turning to Destination
| ||
Hello, I already searched the side but i was not able to find a workable example of how to code in 3D a vehicle slowly turning from his departure point to his destination point. I found which is the shortest angle and many routines which turn the vehicle at once. But what i am looking for is that the vehicle slowly, if possible when moving turns to its destination. Or slowly turning when standing (eg. Tank). My english is not so good, i hope i have explained correctly what i wish to have. Maybe someone could point me (slowly too) in the right direction. (some example code or a hint to a side would be great) Prost Wulde |
| ||
Well if you already know how to turn the vehicle directly to the destination point then all you have to do is: - divide that angle by the amount of time you want to take to make the turn (i.e. the angle is 45 degrees and you want it to turn within .5 sec (game is running at 60 fps) so divide 45 by 30 = 1.5 deg/frame) . - divide a set turn rate by the number of frames/sec to find the deg/frame and then turn that amount for (angle/turnrate*fps) frames (i.e. the angle is 45 degrees and the turn rate is 15 deg/sec (game is running at 60 fps) so divide 15 by 60 = .25 deg/frame for 45/15*60=180 frames). |
| ||
Thank you WolRon. I feared the point when i have to tackle with framerate and timemeasures. But i understand this. Prost Wulde |
| ||
Look up CurveAngle#() in the code archives.. |
| ||
also note that most 4 wheel vehicles come with a rear differential which allows one wheel to spin faster than the other. ie, when the car turns the outer wheel is actually turning faster than the inside This also means that when you go around a left turning corner the car pivots at the left wheel (approx). The pivot moves from the left and the right wheels based on the speed. This is also a good way to drift a car through a corner. |