Is there an arctan function available?

I’d like to do some vector addition. My units have a force applied to them at angles. I would like to do vector addition but save the result back in magnitude and angle. I could do a transform on my whole game and make everything apply force x,y instead of apply force magnitude at an angle, but it would be nice to avoid that. My other option is to do a fast approximation of arctan like

pi/4*x - x*(abs(x) - 1)*(0.2447 + 0.0663*abs(x));

Do I have other options?

3 Likes

Currently we lack in trigonometry, but I understand it’s something that is important. Do you basically need function that outputs sin/cos/tan of a number?

2 Likes

We currently have access to 2 trigonometric functions.

Sin of an angle
Cos of an angle

This is usually all that is needed since you can calculate tan for instance by doing sin(angle) / cos(angle)

What I am requesting is arctan or inverse tangent. Imagine I have a force vector with Fx and Fy. With the arctan function i can find the angle of my force vector by doing arctan(Fy/Fx).

2 Likes

ok, I’ll try adding the following functions:

  • tan of an angle
  • arctan of an angle

do you also need:

  • arccos of an angle
  • arcsin of an angle
2 Likes

with sin and cos you can do tan / cot / sec / csc = so tan might not even be needed.
I’ve only used arctan to get angle. I’m not good enough at math to think of a realistic scenario for arccos and arcsin. Thanks!

2 Likes

Equal forever,@m0dE talked,now i no need talk,but i comment for comment in all topics

1 Like