Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script Physic Moments of inertia

Ollj Oh
Registered User
Join date: 28 Aug 2007
Posts: 522
05-20-2008 05:48
How to calculate the rotational impulse that would be required to get a given rotation on any linkset of all prim-shapes that would be achieved in some time without friction (in sl due to being jumping/free falling)?
I think I have to calculate the "average distance of mass from every prims center of mass" along 3 axes for every prim and then calculate the linkset-average out of that for the whole linkset.
If so, then how to?

I have a problem with getting http://en.wikipedia.org/wiki/Moment_of_inertia right.
When applying an impulse, multiplyed by the objects mass (!) , a (rigid body) hollow prim rotates less the more hollow it is and a prism rotates less than a cylinder due to different http://en.wikipedia.org/wiki/List_of_moments_of_inertia .
Im not even talking about path cut, twist or dimple here.

I have a prim and use llApplyImpulse and llApplyRotationalImpulse for movement.
Prims move by applying an impulse that goes up a little, and then apply a rotational impulse.
(For "walking pets" that move along the ground or on prims this is more efficient, more flexible, more realistic and less processing intensive, than using vehicles, even in havok 4.
(The accuracy of vehicle-damping and linear/angular-deflection is usually not worth its processing in this case. Only for swimming/floating/flying damping vehicle code may be better.))

But if they collide with a wall they have to move back and rotate just the right ammount to avoid the wall, this is hard to tweak for ANY kind of mass distribution while it easily simulates a drunk peasant.
And if they tip over they have to apply the right rotational impulse to get back upright, this is also hard to tweak, it usually rotates too much along its "thin" axis (where mass is close to the center of mass along that axis) and not enough along its "long axis" (where mass is further away from the center of mass along that axis).
Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
05-20-2008 06:30
wrong forum, post in Scripting forum. :)
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
05-20-2008 07:13
From: Dekka Raymaker
wrong forum, post in Scripting forum. :)
That's helpful :)

@Ollj: While I don't understand physics well enough to know how to answer your question, I think do you're going to have a hard time with this task if for no other reason than that the Linden developers have played a little loose with the havok 4 physics engine in a lot of ways.

There are several JIRA issues I've seen that affect physics in some unexpected ways that might complicate what you are trying to do.

Among them are the fact that getting an object's mass is not accurate or as reliable as it ought to be and the fact that in order to simulate increased friction and stop avatars from sliding too much on slopes they actually applied additional downward force to avatars until they were able to empirically discover a value that had the desired results.

While that last item I mentioned isn't likely to be related to what you want to do, it sort of demonstrates that we need our scripts to compensate for goofy LL physics implementations that we aren't even aware of and aren't formally documented anywhere (I wouldn't even know about some of them if I hadn't had JIRA issues related to them).

From: Kelly Linden
To say this code is .... touchy .... might be an understatement. :)


.
_____________________
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
05-20-2008 08:13
Simple answer: Hueristically.

Find the amount that works, and use it.