Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
simple 2D vector graphics part 2: moving in the direction of an angle
#3
(10-28-2022, 09:36 PM)bplus Wrote: Ugh! you make it W A Y too complicated! Sorry I got to say.

dx = change along x axis ie xnew = xold + dx
dy = change along y axis ie ynew = yold + dy

dx = speed * cos(directionRadians)
dy = speed * sin(directionRadians)

Thanks for your reply and sorry for giving you a headache! 

I probably do make it too complicated, I just totally suck at math.
The whole radians thing confuses me. 
According to this article, 1 radian = distanceTravelled/radius. 
That makes no sense to me in this context, 
since there is no circle and hence no radius. 
What should the radius be? 
Half the screen width (or height, whichever is bigger)? 
Or if the world extends to beyond the screen, half of that width? 
And what is distance travelled supposed to be? 
Sorry, I do believe you, just not sure I understandHuh

(Also the precalculated arrays for dx/dy to degrees are to save having to do some of the math on the fly.)
Reply


Messages In This Thread
RE: simple 2D vector graphics part 2: moving in the direction of an angle - by madscijr - 10-28-2022, 10:05 PM



Users browsing this thread: 1 Guest(s)