Rotating 3D points around a Z axis

405 Views Asked by At

I'm messing around with a script for the game and I'm trying to rotate a house.

House consists of multiple objects.

I need to rotate a house for certain degrees but I'm not very good at math and need help with the equation.

Let's say I have a Z axis, an angle alpha and I need to rotate house objects around axis Z for angle alpha degrees and keep the house in the same shape.

1

There are 1 best solutions below

2
On BEST ANSWER

Let the point on 3D house be $(x,y,z)$. $z$ coordinate is unaltered.

$$ x_1= x \cos \theta- y \sin \theta;\, y_1= x \sin \theta + y \cos \theta , \, z_1=z; \,$$