Hi,

I have recently fell in love with dimension building, and have taken it on myself to rebuild the old Dimension Toolbox addon after seeing a number of requests for it. After spending the day looking into the mechanics of dimension building, I am stumbling on something that I just can't get my head around.

I would like to improve on how rotations are calculated. A very straight-forward example, lets say I place a new item in my dimension. By default it will face forward with yaw:0, pitch:0, and roll:0. Now if I want to rotate the item along the yaw by 45 degrees, it becomes yaw:45, pitch:0, and roll:0. Seems easy enough to just load the items yaw, increase it by 45 (well actually, the radian equivalent), and place the item with the new yaw. This works, pretty well, so long as the yaw does not go beyond 90 degrees. When it does, as will be many cases, the simple calculation can no longer be used.

The yaw seems to follow a sine wave, if we imagine the green yaw circle which contains 360 degrees, instead of the yaw value increasing from 0 to 360 as it rotates, it instead ranges from -90 to +90 (0, 45, 90, 45, 0, -45, -90, -45, 0) - where 180 degrees is actually 0. When you reach the first 90 degree point where the value starts to decrease again, the dimension item does an interesting thing and flips 180 degrees on both the pitch and roll planes

So the point where the yaw should read 91, actually equals yaw:89, pitch:-180, roll:-180.

This makes it extremely challenging to allow for +45 degree increments on the yaw plane. When the item is flat and the pitch and roll remain constant at -180 then the calculation can be achieved. but when the item is flipped on it's side as can happen, it would appear that the new calculation for the yaw is dependent on the values of roll and pitch.

Why is this useful? It is very rare that we build on exact 90 degree angles to follow the x,y,z planes. If the dimension is built at say a 30 degree angle, then I would want to be able to easily specify that in the addon for each new item placed - making it easier for everything to align with the angle I have chosen for my constructions (but without any weirdness currently experienced by simply adding the yaw values).

Ultimately I am looking to create a function that does something like this:

I have looked a lot at Euler rotations and there's a lot of posts about vectors and funny greek letters that really means nothing to me. I am not a programmer by trade, or a mathematician. But if anyone who perhaps is could shed some light for me, I would really appreciate it.Code:function ApplyRotation(someItemID) -- Starting values local curYaw = Inspect.Dimension.Layout.Detail(someItemID).yaw; local curPitch = Inspect.Dimension.Layout.Detail(someItemID).pitch; local curRoll = Inspect.Dimension.Layout.Detail(someItemID).roll; -- Rotations to be applied local yawRotation = 45; local pitchRotation = 0; local rollRotation = 0; -- Calculations local newYaw = < do funny calculation here >; local newPitch = < do funny calculation here >; local newRoll = < do funny calculation here >; -- Apply rotation to item Command.Dimension.Layout.Place(SomeItemID, {["yaw"]=newYaw;["roll"]=newRoll;["pitch"]=newPitch})end

Thank you.

## Bookmarks