float IMPULSE = 1.31; // change this value to any value to test default { touch_start(integer n) { // Disable gravity, enable physics, wait for the setting to take effect llSetPhysicsMaterial(GRAVITY_MULTIPLIER, 0, 0, 0, 0); llSetStatus(STATUS_PHYSICS, TRUE); llSleep(0.5); // Begin the test llApplyRotationalImpulse(<0, 0, IMPULSE>, TRUE); llSleep(0.03); // let a simulator frame pass // NOTE: Rotational friction is applied almost instantly, meaning the // returned value will be less than the theoretical one most of the // times. Sometimes we're lucky and get the actual value. vector omega = llGetOmega(); // Disable physics again, return to zero rotation. llSetStatus(STATUS_PHYSICS, FALSE); llSetRot(<0, 0, 0, 1>); // Calculate and report results. vector size = llGetScale(); // Predicted omega is impulse divided by moment of inertia. // Moment of inertia of a box rotating on its z axis is m*(size.x²+size.y²)/12. float predicted = IMPULSE/(llGetMass()*(size.x*size.x+size.y*size.y)/12); llSay(0, "Theoretical omega: " + (string)predicted + ", actual omega: " + (string)omega.z + ", difference:" + (string)(predicted - omega.z) ); } }