S3D_ROTATE(3)

✨ S3D_ROTATE(3) ✨

okay bestie, welcome to the s3d manual, page three of the rotation saga πŸ’… this one lives in section 3 of the manual, and honestly? it's giving main character energy for a function that just spins stuff around.


πŸŽ€ NAME πŸŽ€

s3d_rotate β€” rotate object πŸŒ€


🌸 SYNOPSIS 🌸

#include <s3d.h>

int s3d_rotate(int object, float x, float y, float z);

that's it. that's the whole vibe. three floats and an object, no cap 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

So what does it do? It rotates an object around the x, y and z-axis respectively. The x, y, z values can be anywhere between [0,360] degrees. Slay.

Real talk though: you'll usually only rotate around one axis and just leave the unused fields chilling at 0, I guess. That's the norm, that's the move.

But if you wanna rotate around more than one axis at once, pay attention bestie, because the order matters and it's not negotiable: the order of the rotation applied is y-axis, then x-axis, and then z-axis. Periodt.

Here's the cute mental model the original author offers: think of it like earth position coordinates 🌍

  • x is the longitude
  • y is the latitude
  • z is the rotation at this point of the earth around your bodies axis

(and the author literally wrote "I wonder if that makes it any clearer ;)" and honestly? same, but we're rolling with it πŸ™ˆ)

⚠️ Warning ⚠️ Rotate is absolute, not relative! This is the part where people get humbled, fr fr.
s3d_rotate(object, 90,  0, 0);
s3d_rotate(object, 180, 0, 0);
// object will be rotated 180 degrees around the x-axis, not 270 degress!

Like… the second call doesn't add to the first one. It just sets it. 90 then 180 = 180, not 270. The math girlies are screaming but that's the rule πŸ’€


πŸ’– AUTHOR πŸ’–

Simon Wunderlich Author of s3d πŸ‘‘


and that's the whole page, bestie!! πŸŽ€βœ¨ This was S3D_ROTATE(3) from the s3d manual β€” go forth and rotate responsibly, mwah πŸ«ΆπŸ’–