Add physDisableDeactivation() LSL function to ExtendedPhysics.

Add implementation of physDisableDeactivation to BulletSim.
This commit is contained in:
Robert Adams
2023-05-23 16:41:22 +00:00
parent dd9e365e00
commit cafbf1c977
3 changed files with 131 additions and 57 deletions

View File

@@ -67,6 +67,8 @@ namespace OpenSim.Region.PhysicsModule.BulletS
public const string PhysFunctChangeLinkParams = "BulletSim.ChangeLinkParams";
public const string PhysFunctAxisLockLimits = "BulletSim.AxisLockLimits";
public const string PhysFunctDisableDeactivation = "BulletSim.DisableDeactivation";
// =============================================================
private IConfig Configuration { get; set; }
@@ -138,6 +140,9 @@ namespace OpenSim.Region.PhysicsModule.BulletS
}
// Register as LSL functions all the [ScriptInvocation] marked methods.
// NOTE: YEngine keeps functions as region specific but constants are global static
// so if this is used in multiple regions on a simulator, the constants will
// show up as being redefined.
Comms.RegisterScriptInvocations(this);
Comms.RegisterConstants(this);
@@ -176,6 +181,26 @@ namespace OpenSim.Region.PhysicsModule.BulletS
return ret;
}
[ScriptInvocation]
public float physDisableDeactivation(UUID hostId, UUID scriptId, int disable)
{
int ret = -1;
if (!Enabled) return ret;
if (BaseScene.PhysicsScene != null)
{
if (GetRootPhysActor(hostId, out PhysicsActor rootPhysActor))
{
m_log.DebugFormat("{0} physDisableDeactivation: hostId={1}, scriptId={2}, val={3}", LogHeader, hostId, scriptId, disable);
object[] parms2 = { rootPhysActor, null, disable };
ret = MakeIntError(rootPhysActor.Extension(PhysFunctDisableDeactivation, parms2));
}
}
return ret;
}
// Code for specifying params.
// The choice if 14700 is arbitrary and only serves to catch parameter code misuse.
[ScriptConstant]