Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llApplyRotationalImpulse() question

Marcus Hern
Registered User
Join date: 10 Aug 2006
Posts: 1
08-16-2006 15:03
Anyone know how to make llApplyRotationalImpulse() rotate around a specific point, other than center of gravity of the object or an alternative (that uses physics not manual spinning)?

Thanks,

Marcus Hern
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
08-16-2006 23:56
Only way I can think that you could do this is by applying an llApplyImpusle() with the llApplyRotationalImpulse() to simulate a torque on the object about a point other than it's centre of gravity. As for how to do this precicely that may take some experimenting and some good ole physics/maths.
_____________________
www.nandnerd.info
http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
08-17-2006 07:22
The Vehicle API might be nice as well, for its ability to apply a linear force off-center on an object.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-17-2006 12:37
As nand stated, an angular velocity plus a linear velocity (perpendicular to the axis of rotation) is equivalent to shifting the axis. If the CG is at point C then a pure rotation will result in a velocity field of:
v = w x CP

w - The angular velocity vector (I am too lazy to paste in a real omega character)
P - The test point
v - The velocity at P resulting from the rotational velocity w
x - The vector cross product

What you want is to shift this to the equivalent of a rotation about point Q:
v' = w x QP = w x (QC + CP) = w x CP + w x QC = v + w x QC

Or, if q is the vector pointing from C (the CG) to Q (a point through which the desired axis passes; note that this vector is reversed from the vector QC):
v' = v + q x w

So you should apply the usual angular velocity w plus a linear velocity equal to (q x w); or (q%w) in LSL syntax.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-17-2006 12:58
Oh, forgot to mention I am not completely sure how you actually apply a given angular velocity with 'llApplyRotationalImpulse()', becuase I don't know when exactly SL uses for the moment of inertia. I suspect they just throw the object's mass in instead of a real moment of inertia (so they make the object rotate about any axis like a ring with a 1m radius about that axis would), but I'm not sure of that.

So do some experimenting or use a function that specifies an actual angular velocity: 'llTargetOmega()'.