factor common code out into SOP.RemoveFromPhysics()

0.7.2-post-fixes
Justin Clark-Casey (justincc) 2011-10-15 02:02:39 +01:00
parent 41e7e613a2
commit 50c340ef35
3 changed files with 20 additions and 12 deletions

View File

@ -764,10 +764,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
so.AttachedAvatar = avatar.UUID; so.AttachedAvatar = avatar.UUID;
if (so.RootPart.PhysActor != null) if (so.RootPart.PhysActor != null)
{ so.RootPart.RemoveFromPhysics();
m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
so.RootPart.PhysActor = null;
}
so.AbsolutePosition = attachOffset; so.AbsolutePosition = attachOffset;
so.RootPart.AttachedPos = attachOffset; so.RootPart.AttachedPos = attachOffset;

View File

@ -2022,8 +2022,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
else if (part.PhysActor != null) else if (part.PhysActor != null)
{ {
PhysicsScene.RemovePrim(part.PhysActor); part.RemoveFromPhysics();
part.PhysActor = null;
} }
} }

View File

@ -1589,6 +1589,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
PhysActor = null; PhysActor = null;
} }
// Basic Physics returns null.. joy joy joy. // Basic Physics returns null.. joy joy joy.
if (PhysActor != null) if (PhysActor != null)
{ {
@ -4403,12 +4404,9 @@ namespace OpenSim.Region.Framework.Scenes
|| (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
{ {
AddFlag(PrimFlags.Phantom); AddFlag(PrimFlags.Phantom);
if (PhysActor != null) if (PhysActor != null)
{ RemoveFromPhysics();
m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
/// that's not wholesome. Had to make Scene public
PhysActor = null;
}
} }
else // Not phantom else // Not phantom
{ {
@ -4522,6 +4520,20 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); // m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
} }
/// <summary>
/// This removes the part from physics
/// </summary>
/// <remarks>
/// This isn't the same as turning off physical, since even without being physical the prim has a physics
/// representation for collision detection. Rather, this would be used in situations such as making a prim
/// phantom.
/// </remarks>
public void RemoveFromPhysics()
{
ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
PhysActor = null;
}
public void UpdateRotation(Quaternion rot) public void UpdateRotation(Quaternion rot)
{ {
if ((rot.X != RotationOffset.X) || if ((rot.X != RotationOffset.X) ||