Page 1 of 1

How would I rotate a polygon in 3D space?

Posted: Sun Jun 27, 2021 1:29 pm
by ThatCodingGuy78
I have no idea how to do this, I know how to rotate points (and by extension, lines), but have no idea how to rotate a polygon.
This is not just a polygon BTW, it's a face (of a box) made up of polygons.
I have no clue how to rotate something around a spot that isn't the origin point, as I'm bad at trigonometry.

I tried just rotating the points but that just rotated the individual polygons around their respective origins.

Re: How would I rotate a polygon in 3D space?

Posted: Sun Jun 27, 2021 2:31 pm
by Xii
As you seem to be aware, the correct course of action is to study trigonometry. You're not gonna understand 3D rotations without understanding trigonometry. Search for trigonometry tutorials for game developers. Should be plenty of hits, as trig is a very useful skill to game developers, even in 2D.

Re: How would I rotate a polygon in 3D space?

Posted: Sun Jun 27, 2021 2:38 pm
by ThatCodingGuy78
I'll do that I guess, meanwhile, I figured out a much easier way of doing things. I was accidentally rotating the individual polygons instead of the main shape... I somehow applied my rotatePoints function to the individual points for the polygons so it was rotating the triangles instead of the main shape..