Add the PhysActor to the correct SOP when duplicating a physical

prim. Thanks, MisterBlue
bulletsim
Mic Bowman 2011-06-15 11:26:45 -07:00
parent 289c8fe1bc
commit 29da57e380
1 changed files with 9 additions and 4 deletions

View File

@ -1449,18 +1449,23 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectPart part in partList) foreach (SceneObjectPart part in partList)
{ {
SceneObjectPart newPart;
if (part.UUID != m_rootPart.UUID) if (part.UUID != m_rootPart.UUID)
{ {
SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
newPart.LinkNum = part.LinkNum; newPart.LinkNum = part.LinkNum;
} }
else
{
newPart = dupe.m_rootPart;
}
// Need to duplicate the physics actor as well // Need to duplicate the physics actor as well
if (part.PhysActor != null && userExposed) if (part.PhysActor != null && userExposed)
{ {
PrimitiveBaseShape pbs = part.Shape; PrimitiveBaseShape pbs = part.Shape;
part.PhysActor newPart.PhysActor
= m_scene.PhysicsScene.AddPrimShape( = m_scene.PhysicsScene.AddPrimShape(
string.Format("{0}/{1}", part.Name, part.UUID), string.Format("{0}/{1}", part.Name, part.UUID),
pbs, pbs,
@ -1469,8 +1474,8 @@ namespace OpenSim.Region.Framework.Scenes
part.RotationOffset, part.RotationOffset,
part.PhysActor.IsPhysical); part.PhysActor.IsPhysical);
part.PhysActor.LocalID = part.LocalId; newPart.PhysActor.LocalID = part.LocalId;
part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
} }
} }