0

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.

  • You can rotate 3D objects around an axis or fulcrum in 3-space. When rotating around a point, possibilities are infinite. – Narasimham Dec 14 '18 at 15:15
  • Need to rotate it around the Z axis. Edited. Thanks. –  Dec 14 '18 at 15:16
  • I would use quaternions. They have the theoretical advantage of no gimbal lock, and you can rotate about an arbitrary axis. See the wiki pages for more information. Your programming language probably has a quaternion library you can use for that. – Adrian Keister Dec 14 '18 at 15:18

1 Answers1

0

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; \,$$

Narasimham
  • 40,495
  • Object's Z position is unaltered but the Z angle is not.

    Using the following equations you gave me I should get the same looking but rotated house if I set the object's Z rotation to θ, right?

    –  Dec 14 '18 at 15:25
  • What I gave is for a single point.The shape of house ( called projection) for several points and so planes contained between them as viewed from another view point would change. – Narasimham Dec 14 '18 at 15:31