Re: Strafing in a 2D world!? -
27-07-2004
Although I still think floats are better than doubles (just don't use msvc), a few optimisations are:
Don't bother converting radians to degrees. Simply put in a number for pi/2 (90deg).
From angles directly, or vector cross products, I'd probably say vector cross product - do you really need to know the magnitude if you're simply adding vector components btw? - as you can pull the x and y values needed to offset the movement directly then, without the need to even use sin/cos/tan/etc.
|