Friendly Cosmonaut @friendlycosmonaut.dev · Feb 27

An essential bit of gamedev math - atan2! We often know a target's position and want to face it. But how do we get the angle? angle = atan2(y / x) Or in 3D... angle = atan2(x / z) (We can also see below, what happens if we use atan instead of atan2) #godot #gamedev

112 likes 4 replies

?

Replies

Team SunForge · Feb 27

anything that has to do with direction or circles and trigonometry is a super useful thing to have in your toolkit

Lawrence · Feb 27

I need an entire book of gamedev maths like this

@yitzi2.bsky.social · Feb 27

Correction: atan2(y, z) and atan2(x, z). It's not dividing y by x (if it did, it wouldn't be able to tell the difference between (1, 1) and (-1, -1), which is what atan without the 2 does); it's taking both values separated by a comma.

theoriginalargon.bsky.social · Jun 4

I like the kind of content that you make. Your video on Gamemaker state machines was very useful to me :D