mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 10:46:00 +08:00
For llGetMass(), return the mass of the avatar is the object is attached.
As per http://lslwiki.net/lslwiki/wakka.php?wakka=llGetMass This is the mass as used by the physics engine (ODE or Bullet).
This commit is contained in:
@@ -3514,6 +3514,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mass.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The mass.
|
||||
/// </returns>
|
||||
public float GetMass()
|
||||
{
|
||||
PhysicsActor pa = PhysicsActor;
|
||||
|
||||
if (pa != null)
|
||||
return pa.Mass;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal void PushForce(Vector3 impulse)
|
||||
{
|
||||
if (PhysicsActor != null)
|
||||
|
||||
@@ -2907,10 +2907,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public LSL_Float llGetMass()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (m_host.IsRoot)
|
||||
return m_host.ParentGroup.GetMass();
|
||||
|
||||
if (m_host.ParentGroup.IsAttachment)
|
||||
{
|
||||
ScenePresence attachedAvatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
|
||||
|
||||
if (attachedAvatar != null)
|
||||
{
|
||||
return attachedAvatar.GetMass();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
return m_host.GetMass();
|
||||
{
|
||||
if (m_host.IsRoot)
|
||||
{
|
||||
return m_host.ParentGroup.GetMass();
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_host.GetMass();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void llCollisionFilter(string name, string id, int accept)
|
||||
|
||||
Reference in New Issue
Block a user