MantisBT - opensim
View Issue Details
0008353opensim[REGION] Script Functionspublic2018-08-09 20:582018-08-10 18:17
realtime 
 
normalminoralways
newopen 
OpenSim serverFreeBSD11.2
0.9.0.1 
 
0.9.0.1 binary release
Grid (Multiple Regions per Sim)
ubODE
Mono / Linux64
5.x
Firestorm 5.1.7
0008353: Incorrect handling of radiusoffset in setprimitiveshapeparams
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs around line 8537, this block of code is incorrect:

            // limits on radiusoffset depend on revolutions and hole size (how?) seems like the maximum range is 0 to 1
            if (radiusoffset < 0f)
            {
                radiusoffset = 0f;
            }
            if (radiusoffset > 1f)
            {
                radiusoffset = 1f;
            }
            tempFloat = 100.0f * radiusoffset;
            shapeBlock.PathRadiusOffset = (sbyte)tempFloat;

Actual behaviour should be to limit the radiusoffset to the range 0 to taper.y. The radiusoffset must be zero or negative if taper.y is negative, and zero or positive if taper.y is positive.
1. create a prim
2. add the following script:

default
{
    state_entry()
    {
        list p = [9, 4, 0, <0,1,0>, 0.0, <0,0,0>, <.5,.5,0>, <0,0,0>, <0,1,0>, <-1,-1,0>, 1.0, -0.7, 0.0];
        llSetLinkPrimitiveParamsFast(0, p);
    }
}

3. allow the script to run
4. edit the prim and look at the object parameters - Radius is zero
5. manually adjusting the radius will show it can only be set to negative values
6. manually changing taper y to be closer to zero than radius will show that radius is automatically updated to be equal to taper y to keep it in range
suggested replacement code:

if (taper_a.y < 0f)
{
  if (radiusoffset < taper_a.y)
  {
    radiusoffset = taper_a.y;
  }
  if (radiusoffset > 0f)
  {
    radiusoffset = 0f;
  }
}
else
{
  if (radiusoffset > taper_a.y)
  {
    radiusoffset = taper_a.y;
  }
  if (radiusoffset < 0f)
  {
    radiusoffset = 0f;
  }
}
llSetPrimitiveParams, scripting
Issue History
2018-08-09 20:58realtimeNew Issue
2018-08-09 21:01realtimeTag Attached: llSetPrimitiveParams
2018-08-09 21:01realtimeTag Attached: scripting
2018-08-10 18:17realtimeNote Added: 0032852

Notes
(0032852)
realtime   
2018-08-10 18:17   
On further experimentation, I have encountered a prim where the taper.y is positive, but the radius offset is negative, so my suggested code fix is not correct. Might be easiest to just let the parameter range from -1.0 to 1.0 and it seems it will get clamped to the correct range somewhere else in the simulator code.