BulletSim: add position and rotation update for child prim physics update events. Normally, physics engines do not return updates for child prims so, under normal operation, this code should never execute. Will only be used when using flexible linkset linkages.

0.7.6-extended
Robert Adams 2013-08-21 16:02:42 -07:00 committed by Justin Clark-Casey (justincc)
parent 70438ff6ab
commit d3efb6a7f7
1 changed files with 20 additions and 0 deletions

View File

@ -2502,6 +2502,26 @@ namespace OpenSim.Region.Framework.Scenes
//ParentGroup.RootPart.m_groupPosition = newpos; //ParentGroup.RootPart.m_groupPosition = newpos;
} }
if (pa != null && ParentID != 0 && ParentGroup != null)
{
// RA: Special case where a child object is requesting property updates.
// This happens when linksets are modified to use flexible links rather than
// the default links.
// The simulator code presumes that child parts are only modified by scripts
// so the logic for changing position/rotation/etc does not take into
// account the physical object actually moving.
// This code updates the offset position and rotation of the child and then
// lets the update code push the update to the viewer.
// Since physics engines do not normally generate this event for linkset children,
// this code will not be active unless you have a specially configured
// physics engine.
Quaternion invRootRotation = Quaternion.Normalize(Quaternion.Inverse(ParentGroup.RootPart.RotationOffset));
m_offsetPosition = pa.Position - m_groupPosition;
RotationOffset = pa.Orientation * invRootRotation;
m_log.DebugFormat("{0} PhysicsRequestingTerseUpdate child: pos={1}, rot={2}, offPos={3}, offRot={4}",
"[SCENE OBJECT PART]", pa.Position, pa.Orientation, m_offsetPosition, RotationOffset);
}
ScheduleTerseUpdate(); ScheduleTerseUpdate();
} }