<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Tom, I think this is a difference in implementation details.  To
      me, Bullet actually gets it correct.   <br>
    </p>
    <p>Your script is setting Hover height to go up and down. It is
      effectively  llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT,
      HovHeightBase += .02 ); each click Up and -= 0.02 on Down, while
      starting from a negative value.   Zero is water height (typically
      20 meters).    Water height can range from 0 to +100 in a sim.<br>
    </p>
    <p>The problem is that VEHICLE_HOVER_HEIGHT is for use only above
      ground.    It is not defined in LSL by Second Life for use with
      negative numbers, with additional proof of this is that zero
      (water height) disables it entirely.   So it is implementation
      specific.  I would chalk this up as expected behavior in Bullet.  
      <br>
    </p>
    <p>Try adding a float Z variable to your
      VEHICLE_LINEAR_MOTOR_DIRECTION and add or subtract a small amount
      from the Z (up)  axis.     <br>
    </p>
    <p>Your axis seems suspicious. In vehicles, X is forward/back, Y is
      L-R, and Z is up.  Your script right and left controls are setting
      VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 5.0>, which is
      mucking around with Z (Up).  Sounds correct for a prim that
      rotates around Z, but not for a vehicle.  I could be wrong here. 
      There may be a VEHICLE_REFERENCE_FRAME set in your script
      elsewhere that is overriding the reference axis, so be wary of it.</p>
    Also, take a look at the function llWater(), and think about doing
    this:<br>
    <br>
    vector water = llWater(<span class="kw2" style="color: rgb(0, 0,
      128);">ZERO_VECTOR</span>);<br>
    HovHeightBase += water.z - 20;<br>
    <br>
    This will handle sims where water is at a different level.
    <pre class="moz-signature" cols="72">regards and good luck:\
  Ferd Frederix/Fred Beckhusen

</pre>
    <div class="moz-cite-prefix">On 2017-05-01 5:20 AM,
      <a class="moz-txt-link-abbreviated" href="mailto:opensim-users-request@opensimulator.org">opensim-users-request@opensimulator.org</a> wrote:<br>
    </div>
    <blockquote
      cite="mid:mailman.574.1493634059.1879.opensim-users@opensimulator.org"
      type="cite">
      <pre wrap="">Send Opensim-users mailing list submissions to
        <a class="moz-txt-link-abbreviated" href="mailto:opensim-users@opensimulator.org">opensim-users@opensimulator.org</a>

To subscribe or unsubscribe via the World Wide Web, visit
        <a class="moz-txt-link-freetext" href="http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users">http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users</a>
or, via email, send a message with subject or body 'help' to
        <a class="moz-txt-link-abbreviated" href="mailto:opensim-users-request@opensimulator.org">opensim-users-request@opensimulator.org</a>

You can reach the person managing the list at
        <a class="moz-txt-link-abbreviated" href="mailto:opensim-users-owner@opensimulator.org">opensim-users-owner@opensimulator.org</a>

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Opensim-users digest..."


Today's Topics:

   1. ubODE vs. Bullet (<a class="moz-txt-link-abbreviated" href="mailto:tringate@gmail.com">tringate@gmail.com</a>)
   2. Re: ubODE vs. Bullet (AJLDuarte)


----------------------------------------------------------------------

Message: 1
Date: Sun, 30 Apr 2017 23:27:37 -0400
From: <a class="moz-txt-link-rfc2396E" href="mailto:tringate@gmail.com"><tringate@gmail.com></a>
To: "OS-Opensim Users" <a class="moz-txt-link-rfc2396E" href="mailto:opensim-users@opensimulator.org"><opensim-users@opensimulator.org></a>
Subject: [Opensim-users] ubODE vs. Bullet
Message-ID: <65ED585961044A12B8C19EA5984238E3@TomsDesktop>
Content-Type: text/plain; charset="utf-8"

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
**********************************
</pre>
    </blockquote>
    <br>
  </body>
</html>