Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Science Project! canceling rotational velocity

Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-28-2008 09:22
Hi All...

llGetOmega returns rotational velocity...

I suspect that there is a good/easy way to cancel that velocity...

What I have is a floating, physical platform, and I want to cause it to try to stay flat/level by adding impulses to it.

I can detect my angle error from level... but really, I want to add an impulse back into it to cancel the rotational velocity... plus a little more to nudge it back to level.

This really is a sort of science project, I know... I don't want to use vehicle or non physical tricks here...

so if I walk from one side of the platform to the other... naturally, it will want to tilt toward the side I am standing....

there will be some funny maths here I am sure.

I have some lame attempts that have a hysterisis problem (causing the platform to overcorrect and is inherently unstable).

Anyone have any cool ideas about this?

THanks!
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
05-28-2008 11:10
I believe you may be looking for 'llApplyRotationalImpulse(-llGetOmega(), FALSE);' I don't think SL objects have moments of inertia (or rather, I guess we could say they are always of unit value), so I think a change in angular momentum is numerically equal to a change in rotational velocity.

See http://www.lslwiki.net/lslwiki/wakka.php?wakka=llApplyRotationalImpulse
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-28-2008 21:46
Ok, that almost worked ! I had to read up on impulse a bit... the values had to be multiplied by the mass of the object...

Once I did that... worked great!

Thanks a bunch Hewee :)

-Ryder-
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
05-28-2008 23:16
the most efficient way to keep your platform level would be to lock rotation. See llSetStatus (http://wiki.secondlife.com/wiki/LlSetStatus) for details.
Ollj Oh
Registered User
Join date: 28 Aug 2007
Posts: 522
05-29-2008 04:48
in havok4 rigid bodies do have inertia, for a rotational impulse it does matter how far away the mass is from its rotational center!

an impulse*llGetMass() results in more rotation the less it is hollowed.
an impulse*llGetmass() results in more rotation on a cylinder/sphere than on a cube/prism.
Linked objects in hammer-shapes and cut prims also show a nice approximation of inrtia.
(tested free falling)
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
05-29-2008 07:21
From: Ollj Oh
in havok4 rigid bodies do have inertia, for a rotational impulse it does matter how far away the mass is from its rotational center!

That's great, but it means we really, REALLY need a llGetMomentOfInertia() function (possibly taking the prospective axis of rotation as a parameter)!