Jump to content

To enable physics upto 32 PE (Any viewer)


Kaluura Boa
 Share

You are about to reply to a thread that has been inactive for 4543 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

UPDATE: The more I work with physics cost, the more I learn...

UPDATE 2: Of course, you must read "32 PE", not 64.

The title says it all. Here is the script:

default
{
    on_rez(integer param) { llResetScript(); }
    
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(LINK_ALL_CHILDREN,
                            [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_NONE,
                            PRIM_LINK_TARGET, LINK_THIS,
                            PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]);
        llSleep(0.5);
        float prc = llList2Float(llGetObjectDetails(llGetKey(), [OBJECT_PHYSICS_COST]), 0);
        string text = "/me -- Physics cost: " + (string)prc + " PE";
        if (prc > 32.0) { text += " -- Cannot enable physics."; }
        llOwnerSay(text);
        //
        // Auto-clean.
        llSleep(1.0);
        llRemoveInventory(llGetScriptName());
    }
}

 After that, you can enable/disable physics simply through the Tools floater in any viewer --even if not mesh-aware, or with a regular vehicle script.(Use llSetStatus() which seems more reliable than PRIM_PHYSICS.) But, more importantly, you may want to add regular prims so that you object does not lean, take a tumble or sink in the ground while it is trying stand on its root prim only with all its child prims phantom but not weightless... <grin>

Beware! Unlinking let the prims revert to regular prims. The physics shape type is not saved as permanent prim property.

Either you link the prims that must keep your vehicle over the ground after using my script, or else you use it on the whole vehicle and reset the wheels/land gear/legs/what-not prims one by one with the following (auto-clean) script:

default
{
    on_rez(integer param) { llResetScript(); }
    
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM]);
        llSleep(1.0);
        llRemoveInventory(llGetScriptName());
    }
}

To check the physics cost of your vehicle:

default
{
    on_rez(integer param) { llResetScript(); }
    
    state_entry()
    {
        list tempo = llGetObjectDetails(llGetKey(), [OBJECT_PRIM_EQUIVALENCE, OBJECT_PHYSICS_COST]);
        llOwnerSay(llList2String(tempo, 0) + " PE");
        llOwnerSay("Physics Cost: " + llList2String(tempo, 1) + " PE");
        llSleep(1.0);
        llRemoveInventory(llGetScriptName());
    }
}

That should be all... until I learn something new. :matte-motes-wink:

Link to comment
Share on other sites

The limit for making an object physical with the new accounting system is still a "Physics Weight" of 32 or less. The PE (now called Land Impact) can be any number up to 15000. A  "Physics Weight" of up to 64 is the limit for the use of the llSetKeyframedMotion function.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4543 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...