factor common code out into SOP.RemoveFromPhysics()

remove-scene-viewer
Justin Clark-Casey (justincc) 2011-10-15 02:02:39 +01:00
parent 978fb3d482
commit c93c9ea072
3 changed files with 19 additions and 11 deletions

View File

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

View File

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

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);
PhysActor = null;
}
// Basic Physics returns null.. joy joy joy.
if (PhysActor != null)
{
@ -4399,12 +4400,9 @@ namespace OpenSim.Region.Framework.Scenes
|| (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
{
AddFlag(PrimFlags.Phantom);
if (PhysActor != null)
{
m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
/// that's not wholesome. Had to make Scene public
PhysActor = null;
}
RemoveFromPhysics();
}
else // Not phantom
{
@ -4518,6 +4516,20 @@ namespace OpenSim.Region.Framework.Scenes
// 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)
{
if ((rot.X != RotationOffset.X) ||