Quote:
Originally posted by Kaimetsu
Maintain an (dx,dy) for your current velocity. Add to it when you use the thruster in a given direction (dx+accel*cos(ang),dy+accel*sin(ang)) and limit the total speed with a unit vector. Ie:
mag=(dx^2+dy^2)^0.5;
if(mag>maxspeed){
dx=maxspeed*dx/mag;
dy=maxspeed*dy/mag;
}
|
Isn't there a way I could do this without saving a dx/dy and just saving the angle you're traveling in and the speed?