let llSetBuoyancy work on attachments. But unlike at sl, the effect is not removed when the script or its prim is removed/deattached. SO use with care. THis lmitation was a reason why we did not let is work on attachments

This commit is contained in:
UbitUmarov
2025-09-05 19:22:12 +01:00
parent 2950d07c86
commit 153a5e978a
3 changed files with 29 additions and 7 deletions

View File

@@ -5340,6 +5340,19 @@ namespace OpenSim.Region.Framework.Scenes
return null;
}
public void SetBuoyancy(float fvalue)
{
if(IsAttachment)
{
ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
PhysicsActor pa = avatar?.PhysicsActor;
if( pa is not null )
pa.Buoyancy = fvalue;
}
else
RootPart.Buoyancy = fvalue;
}
public override string ToString()
{
return $"{Name} {UUID} ({AbsolutePosition})";

View File

@@ -1602,14 +1602,24 @@ namespace OpenSim.Region.Framework.Scenes
}
set
{
if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart != this)
if (ParentGroup != null)
{
ParentGroup.RootPart.Buoyancy = value;
return;
if (ParentGroup.RootPart != null && ParentGroup.RootPart != this)
{
ParentGroup.RootPart.Buoyancy = value;
return;
}
if (ParentGroup.IsAttachment)
{
ScenePresence avatar = m_scene.GetScenePresence(ParentGroup.AttachedAvatar);
PhysicsActor pa = avatar?.PhysicsActor;
if (pa != null)
pa.Buoyancy = value;
}
else if (PhysActor != null)
PhysActor.Buoyancy = value;
}
m_buoyancy = value;
if (PhysActor != null)
PhysActor.Buoyancy = value;
}
}