I need a formula with these outputs.

47 Views Asked by At

I need a formula for when i put in a value for k it gives me an output. Here are the outputs I know, but I need everything in between 0 to 259. It should be a circle. (I'm making a game that has a third person view that spins around when the player changes their yaw and I'm 14 so i don't know how to do this yet)

if k=0 then x=0 and z=5

if k=90 then x=5 and z=0

if k=180 then x=0 and z=-5

if k=-90 then x=-5 and z=0

1

There are 1 best solutions below

2
On

Here are the formulas, written in degrees:

$$x= 5*\cos(90-k), \ \ y=5*\sin(90-k) $$

(they take into account the fact that you move clockwise on the circle, beginning at 90°).

Comment: you might need a prior conversion of your angles into radians (the natural unit in mathematics), with conversion factor:

$$deg=3.1416/180 \ \ \text{(have you recognized} \ \pi \ \text{)? And then} $$

$$x=5*\cos((90-k)*deg), \ \ y=5*\sin((90-k)*deg).$$