Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rotating a prim around an axis on a face

EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
07-13-2009 15:40
Is anyone able to provide a code fragment demostrating how to rotate a linked box prim around an axis lying on one of its faces rather than around the one passing through the centre?

Cutting the box path to make an effective face along the central axis won't help in this particular case.

Thanks for any help.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
07-13-2009 17:09
Rotating a prim around an arbitrary axis other than the central one requires both setting the rotation and the position.

The math might be a little tricky, and may be dependent on the specific effect you are trying to achieve. Note, however, it will most likely be a bit choppy movement, as you can't do it with something like llTargetOmega.
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
07-13-2009 19:04
if it's a box, you could use the new slice option and slice it in half, so the axis you want is right on the edge of that face, then just use normal rotation stuff.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
07-13-2009 19:52
From: Lazink Maeterlinck
if it's a box, you could use the new slice option and slice it in half, so the axis you want is right on the edge of that face, then just use normal rotation stuff.


He specifically stated that wasn't an option. :)
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
07-13-2009 19:59
From: Talarus Luan
He specifically stated that wasn't an option. :)


Meh, helps to read the whole thing then skim :P
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
07-13-2009 20:38
From: Talarus Luan
Rotating a prim around an arbitrary axis other than the central one requires both setting the rotation and the position.

The math might be a little tricky, and may be dependent on the specific effect you are trying to achieve. Note, however, it will most likely be a bit choppy movement, as you can't do it with something like llTargetOmega.
I was afraid of that. Thank goodness for plan B again. Thank you :)

From: Talarus Luan
He specifically stated that wasn't an option.
The only thing in my profile is my picture. Even at such low resolution, the mistake in this statement should be obvious :)
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-13-2009 22:19
this may help you...
https://wiki.secondlife.com/wiki/User:Void_Singer/Rotations

because it's linked you'll need to do a move position + change rot, and it'll probably be easier to do it in the child prim that's rotating. your offset will be the distance from the prim center to the point on the face that you want to rotate around (position + .5 of the x size for the center of the +x face)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
07-15-2009 08:17
Many thanks, Void. The examples demonstrate the technique very well. Unfortunately they appear to run into either my inept implemetation or the llSetPrimitiveParams/PRIM_ROTATION bug when applied to child prims. I have set out my problem more completely in a new post, "Wristwatch hand problem", should you be inclined to to offer any further assistance :)