Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Moving an object w/rotating parts

Bartiloux Desmoulins
Think Kink? Think Bart!
Join date: 27 Sep 2005
Posts: 121
05-02-2006 11:30
I have this rectangular table I built. Mid-way down I have two bars protruding up from the sides, going up about a meter and then making a 90-degree turn into one another, forming, if you could imagine, an inverted "U" over the table.

On the portion of the bar that is parallel with the surface of the table I have another 9-prim "wheel" that I built that I would like to have rotate, using the bar as it's rotate axis point of origin. With a very simple script I can add a command to have the wheel rotate either along the x or y axis, depending how the table is situated.

However, I would like to incorporate some flexibility into my build and allow the wheel to compensate for any angle placement of the table so that the wheel "knows" what axis to use for its rotation. As is, if I code the script to rotate along the x axis and then turn the table 90 degrees, the wheel, instead of rolling, lazily flips, side over side.

Can anyone offer some advice as to how I can make my wheel "smart" so that it rotates along the bar, no matter in what angle the bar/table is positioned? Thank you!!
Spartan Mistral
Registered User
Join date: 2 May 2006
Posts: 2
05-02-2006 18:18
From: Bartiloux Desmoulins
I have this rectangular table I built. Mid-way down I have two bars protruding up from the sides, going up about a meter and then making a 90-degree turn into one another, forming, if you could imagine, an inverted "U" over the table.

On the portion of the bar that is parallel with the surface of the table I have another 9-prim "wheel" that I built that I would like to have rotate, using the bar as it's rotate axis point of origin. With a very simple script I can add a command to have the wheel rotate either along the x or y axis, depending how the table is situated.

However, I would like to incorporate some flexibility into my build and allow the wheel to compensate for any angle placement of the table so that the wheel "knows" what axis to use for its rotation. As is, if I code the script to rotate along the x axis and then turn the table 90 degrees, the wheel, instead of rolling, lazily flips, side over side.

Can anyone offer some advice as to how I can make my wheel "smart" so that it rotates along the bar, no matter in what angle the bar/table is positioned? Thank you!!


All you have to do is check the current rotation with llGetLocalRot(). If you need actual axis-of-rotation information, you can convert that using llRot2Axis, llRot2Fwd, etc., depending on how you constructed the wheel.
Bartiloux Desmoulins
Think Kink? Think Bart!
Join date: 27 Sep 2005
Posts: 121
Thank you...
05-02-2006 19:28
Thank you for the reply to my question. I'm finding, however, while reading the many wonderful posts here in the forum, that many of the answers that are provided are given under the assumption that the author of the question has a good understanding of the tools, tricks and terminology of LSL, so they can just go forth and code. Being an extreme newbie, however, I was wondering if I could ask for just a bit more detail, perhaps even as far as the inclusion of some code "snippets" to help me more clearly understand the solution to my problem? Thank you, again, and please forgive my ignorance. I will strive to learn as much as I can as quickly as I can!! -Bartiloux