Projecting a point

Something I’ve really wanted to do for a while is be able to project a point in a direction. Basically, you say projectPoint(x,y,angle, distance). I understand that means knowing how to use sin and cosin and know triginometry, so I can’t figure out the formula (because I’m only in middle school). If someone could help me, that would be great.

How do x,y and angle relate?

Are you wanting to start at x,y and go in the direction of the angle? If so then, how far?

Are you looking to draw a dot there or a line?

Sorry. I forgot to add the parameter distance. So I was thinking of using triangles. So we know the hypotenuse and all the angles (if we subtract the angle and 90 from 180). I may just be clueless.

I presume that you are in 2D, that you are starting at (x,y) and moving in the direction specified by angle for a distance of distance. If this is correct, the formula is:

X = x + distance * math.cos(angle)
Y = y + distance * math.sin(angle)

You need to make sure that your angles are in radians.

Alright. Thanks. My plan is also to use it in 3D eventually too though, so I’ll see. Thanks!