Hi,

                ubOde and bullet where created in parallel so naturally had 
different interpretations of details and implementation.

                Making them more identical is a slow and hard going on process.

                To check if ubode or bullet are more corret on a feature, one 
needs to compare to original reference.

                This does not mean we will not add Opensim extensions, but 
those will be flagged as such

                Old ODE has its very own idea of vehicles (should no longer be 
used on new regions)

                On this case ubOde seems correct…  but then  im biased on that 
;)

Ubit

 

From: [email protected] 
[mailto:[email protected]] On Behalf Of [email protected]
Sent: Monday, May 01, 2017 04:28
To: OS-Opensim Users
Subject: [Opensim-users] ubODE vs. Bullet

 

I am working on a script for a submarine and am having issues with it working 
fine in ubode but will not dive or surface in Bullet physics.

 

Here are the primary items that are involved with the physics.

 

This is the initial settings the object is set with.

 

set_engine(){

    llSetVehicleType(VEHICLE_TYPE_BOAT);

    llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.5);

    llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 0.1);

    llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 0.1);

    llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.80);

    llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1, 1, 1>);      
  

    llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.2);

    llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 1.0);

    llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.5);

    llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.2);

    llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, <0.1, 0.1, 
0.1>);

    llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.5);

    llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 1.0);

    llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0.0); // set ball at water 
surface

    llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0.5 );

    llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 1.0 ); 

}

 

These are the controls and they work fine in ubODE, but CONTROL_UP and 
CONTROL_DOWN do nothing in Bullet.

 

control(key id, integer level, integer edge)

    {

        float    gForwardThrust; // variable for forward thrust 

        float    gReverseThrust = -1.5; // reverse thrust backup speed

        if(level & CONTROL_FWD)

        {

            Swimming();

            gForwardThrust = 3; // normal forward speed

            vTarget = llGetPos(); // get our current position

            // if near region edge, slow down

            if (vTarget.x > xlimit || vTarget.x < gGuard || vTarget.y > ylimit 
|| vTarget.y < gGuard) 

            {

                if (vTarget.x > xlimit) vTarget.x = xlimit;

                if (vTarget.x < gGuard) vTarget.x = gGuard;

                if (vTarget.y > xlimit) vTarget.y = ylimit;

                if (vTarget.y < gGuard) vTarget.y = gGuard;

                gForwardThrust = .3; // slow us down

                llWhisper(0, "Approaching sim edge, drive away...");

            }

            if ( vTarget.z < (llGround ( ZERO_VECTOR ) + 0.35) )

            {    // too shallow and going to collide with land

                gForwardThrust = .05; // slow us down

                llWhisper(0, "Too shallow, drive away...");

            }

            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, 
<gForwardThrust,0,0>);

        }

        if(level & CONTROL_BACK)

        {

            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, 
<gReverseThrust,0,0>); // back us up

            return;

        }

        if(level & (CONTROL_UP))

        {

            HovHeightBase = HovHeightBase + 0.02;

            llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, HovHeightBase);

        }

        if(level & (CONTROL_DOWN))

        {

            HovHeightBase = HovHeightBase - 0.02;

            llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, HovHeightBase);

        }

        if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT)) 
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0,-5.0>);

        if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT)) 
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 5.0>);

        if(edge & ~level & (CONTROL_FWD|CONTROL_BACK)) Treading();

    }

 

I might add this is actually from my swim ball script which also works just 
fine in ubODE but fails in Bullet on the dive and surface actions.

 

In bullet nothing at all happens.

 

Is this a bug in opensim?  I know it is expected a script that works in one 
physics engine is suppose to work in the other physics engines as well.

 

Not being an expert at script writing, it is possible I stumbled into doing 
something wrong that ubODE can deal with and Bullet can’t.

 

Tom

 

_______________________________________________
Opensim-users mailing list
[email protected]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users

Reply via email to