How can I find the X and Y intercepts on a circle, using the angle?

52 Views Asked by At

This is the exact situation I have

so while making a video game we ran into an issue with the bullet aim. The problem here is that we have only been given the angle and need to figure out how to calculate the (x ,y) intercepts.

we tried to using -sin(A) to find Y and -cos(A) to find X, but there was an exponential offset which we couldn't fix.

Ps* we are novice video game developers at best, any other ideas would be greatly appreciated.

1

There are 1 best solutions below

3
On

What you are looking for are basically polar coordinates. So you can simply convert from polar coordinates $(r, \theta)$ to cartesian coordinates $(x, y)$ using:

$$x=r \cdot cos(\theta)$$ $$y=r \cdot sin(\theta)$$

Where $\theta$ is your angle, and for your specific case $r=1$. Also make sure you know what argumets your trig functions take (degrees or radians) because that can often cause trouble.

Not sure what you mean by exponential offset.