Implement llSetPrimitiveParams for physics shape and material. Add
llSetPhysicsMaterial support.avinationmerge
parent
d4e6834f99
commit
8388182707
|
@ -7632,6 +7632,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetPhysicsMaterial(SceneObjectPart part, int material_bits,
|
||||||
|
float material_density, float material_friction,
|
||||||
|
float material_restitution, float material_gravity_modifier)
|
||||||
|
{
|
||||||
|
ExtraPhysicsData physdata = new ExtraPhysicsData();
|
||||||
|
physdata.PhysShapeType = (PhysShapeType)part.PhysicsShapeType;
|
||||||
|
physdata.Density = part.Density;
|
||||||
|
physdata.Friction = part.Friction;
|
||||||
|
physdata.Bounce = part.Bounciness;
|
||||||
|
physdata.GravitationModifier = part.GravityModifier;
|
||||||
|
|
||||||
|
if ((material_bits & (int)ScriptBaseClass.DENSITY) != 0)
|
||||||
|
physdata.Density = material_density;
|
||||||
|
if ((material_bits & (int)ScriptBaseClass.FRICTION) != 0)
|
||||||
|
physdata.Friction = material_friction;
|
||||||
|
if ((material_bits & (int)ScriptBaseClass.RESTITUTION) != 0)
|
||||||
|
physdata.Bounce = material_restitution;
|
||||||
|
if ((material_bits & (int)ScriptBaseClass.GRAVITY_MULTIPLIER) != 0)
|
||||||
|
physdata.GravitationModifier = material_gravity_modifier;
|
||||||
|
|
||||||
|
part.UpdateExtraPhysics(physdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void llSetPhysicsMaterial(int material_bits,
|
||||||
|
float material_gravity_modifier, float material_restitution,
|
||||||
|
float material_friction, float material_density)
|
||||||
|
{
|
||||||
|
SetPhysicsMaterial(m_host, material_bits, material_density, material_friction, material_restitution, material_gravity_modifier);
|
||||||
|
}
|
||||||
|
|
||||||
public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
|
public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
|
||||||
{
|
{
|
||||||
llSetLinkPrimitiveParamsFast(linknumber, rules);
|
llSetLinkPrimitiveParamsFast(linknumber, rules);
|
||||||
|
@ -8043,6 +8073,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
part.ScriptSetPhysicsStatus(physics);
|
part.ScriptSetPhysicsStatus(physics);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
|
||||||
|
if (remain < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int shape_type = rules.GetLSLIntegerItem(idx++);
|
||||||
|
|
||||||
|
ExtraPhysicsData physdata = new ExtraPhysicsData();
|
||||||
|
physdata.Density = part.Density;
|
||||||
|
physdata.Bounce = part.Bounciness;
|
||||||
|
physdata.GravitationModifier = part.GravityModifier;
|
||||||
|
physdata.PhysShapeType = (PhysShapeType)shape_type;
|
||||||
|
|
||||||
|
part.UpdateExtraPhysics(physdata);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL:
|
||||||
|
if (remain < 5)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int material_bits = rules.GetLSLIntegerItem(idx++);
|
||||||
|
float material_density = (float)rules.GetLSLFloatItem(idx++);
|
||||||
|
float material_friction = (float)rules.GetLSLFloatItem(idx++);
|
||||||
|
float material_restitution = (float)rules.GetLSLFloatItem(idx++);
|
||||||
|
float material_gravity_modifier = (float)rules.GetLSLFloatItem(idx++);
|
||||||
|
|
||||||
|
SetPhysicsMaterial(part, material_bits, material_density, material_friction, material_restitution, material_gravity_modifier);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
|
case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
|
||||||
if (remain < 1)
|
if (remain < 1)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -417,6 +417,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
LSL_String llXorBase64Strings(string str1, string str2);
|
LSL_String llXorBase64Strings(string str1, string str2);
|
||||||
LSL_String llXorBase64StringsCorrect(string str1, string str2);
|
LSL_String llXorBase64StringsCorrect(string str1, string str2);
|
||||||
LSL_Integer llGetLinkNumberOfSides(LSL_Integer link);
|
LSL_Integer llGetLinkNumberOfSides(LSL_Integer link);
|
||||||
|
void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density);
|
||||||
|
|
||||||
void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
|
void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
|
||||||
LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
|
LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
|
||||||
|
|
|
@ -570,6 +570,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int PRIM_MEDIA_PERM_OWNER = 1;
|
public const int PRIM_MEDIA_PERM_OWNER = 1;
|
||||||
public const int PRIM_MEDIA_PERM_GROUP = 2;
|
public const int PRIM_MEDIA_PERM_GROUP = 2;
|
||||||
public const int PRIM_MEDIA_PERM_ANYONE = 4;
|
public const int PRIM_MEDIA_PERM_ANYONE = 4;
|
||||||
|
|
||||||
|
public const int PRIM_PHYSICS_SHAPE_TYPE = 30;
|
||||||
|
public const int PRIM_PHYSICS_SHAPE_PRIM = 0;
|
||||||
|
public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
|
||||||
|
public const int PRIM_PHYSICS_SHAPE_NONE = 1;
|
||||||
|
|
||||||
|
public const int PRIM_PHYSICS_MATERIAL = 31;
|
||||||
|
public const int DENSITY = 1;
|
||||||
|
public const int FRICTION = 2;
|
||||||
|
public const int RESTITUTION = 4;
|
||||||
|
public const int GRAVITY_MULTIPLIER = 8;
|
||||||
|
|
||||||
// extra constants for llSetPrimMediaParams
|
// extra constants for llSetPrimMediaParams
|
||||||
public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0);
|
public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0);
|
||||||
|
|
|
@ -1949,5 +1949,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
{
|
{
|
||||||
m_LSL_Functions.llSetKeyframedMotion(frames, options);
|
m_LSL_Functions.llSetKeyframedMotion(frames, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density)
|
||||||
|
{
|
||||||
|
m_LSL_Functions.llSetPhysicsMaterial(material_bits, material_gravity_modifier, material_restitution, material_friction, material_density);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue