Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Calculating Rotations

Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
03-30-2008 02:35
Hi guys,

I am trying to script four prims to make a pyramid shape, and I am having all kinds of trouble with calculating rotations.

I tried it manually without success, and I am sure there must be a simple formula for working it out, if anyone has it.

Imagine a flat square prim on the ground, the base. Imagine then a prim 2x2x10 and I want to place that at one corner of the base, and the other end touching the highest apex point of the base that it can.

I have worked out the rotations mathematically. I need to rotate the prim first horizontally by 45 degrees (315 degrees), then rotate it vertically by 63.435 degrees (296.565 degrees).

The first rotation is simple enough, but if I then go to Local coordinates, and rotate the prim vertically, then all the rotations go haywire. The prim itself looks fine, but the axis i am rotating on does not show the 63.435 degrees I am looking for, and the axis I have not rotated on now has a value in it.

Does anyone know how to turn rotations in 2 axes into 3 axes values?

Many thanks for any advice here. I will cross post this in the scripting forum too, as this is applaciable to both scripting and building.
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
03-30-2008 05:39
I'd say you should rotate *first* in the x or y plane (your 63.xxx degrees) and *then* in the z plane (by 45) -- instead of the other way around as you described... the order matters.

If you need it automated somehow then probably responses in the scripting forum will be helpful.
_____________________
http://slurl.com/secondlife/Together