mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
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:
@@ -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})";
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user