Eliminate race condition where many callers would check SOP.PhysicsActor != null then assume it was still not null in later code.
Another thread could come and turn off physics for a part (null PhysicsActor) at any point. Had to turn off localCopy on warp3D CoreModules section in prebuild.xml since on current nant this copies all DLLs in bin/ which can be a very large number with compiled DLLs No obvious reason for doing that copy - nothing else does it.0.7.3-extended
parent
45c617b5c3
commit
d9585ba37e
|
@ -36,6 +36,7 @@ using OpenSim.Framework.Capabilities;
|
||||||
using OpenSim.Framework.Client;
|
using OpenSim.Framework.Client;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Region.Physics.Manager;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
@ -1785,10 +1786,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
if (!grp.IsDeleted)
|
if (!grp.IsDeleted)
|
||||||
{
|
{
|
||||||
if (grp.RootPart.PhysActor != null)
|
PhysicsActor pa = grp.RootPart.PhysActor;
|
||||||
{
|
if (pa != null)
|
||||||
grp.RootPart.PhysActor.CrossingFailure();
|
pa.CrossingFailure();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: Prim crossing failed for {0}", grp);
|
m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: Prim crossing failed for {0}", grp);
|
||||||
|
|
|
@ -642,10 +642,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#endregion Region Settings
|
#endregion Region Settings
|
||||||
|
|
||||||
MainConsole.Instance.Commands.AddCommand("Estates", false, "reload estate",
|
|
||||||
"reload estate",
|
|
||||||
"Reload the estate data", HandleReloadEstate);
|
|
||||||
|
|
||||||
//Bind Storage Manager functions to some land manager functions for this scene
|
//Bind Storage Manager functions to some land manager functions for this scene
|
||||||
EventManager.OnLandObjectAdded +=
|
EventManager.OnLandObjectAdded +=
|
||||||
new EventManager.LandObjectAdded(simDataService.StoreLandObject);
|
new EventManager.LandObjectAdded(simDataService.StoreLandObject);
|
||||||
|
|
|
@ -324,7 +324,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (rot != null)
|
if (rot != null)
|
||||||
sceneObject.UpdateGroupRotationR((Quaternion)rot);
|
sceneObject.UpdateGroupRotationR((Quaternion)rot);
|
||||||
|
|
||||||
if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
|
PhysicsActor pa = sceneObject.RootPart.PhysActor;
|
||||||
|
if (pa != null && pa.IsPhysical && vel != Vector3.Zero)
|
||||||
{
|
{
|
||||||
sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false);
|
sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false);
|
||||||
sceneObject.Velocity = vel;
|
sceneObject.Velocity = vel;
|
||||||
|
|
|
@ -505,16 +505,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_isSelected = value;
|
m_isSelected = value;
|
||||||
// Tell physics engine that group is selected
|
// Tell physics engine that group is selected
|
||||||
if (m_rootPart.PhysActor != null)
|
|
||||||
|
PhysicsActor pa = m_rootPart.PhysActor;
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
m_rootPart.PhysActor.Selected = value;
|
pa.Selected = value;
|
||||||
|
|
||||||
// Pass it on to the children.
|
// Pass it on to the children.
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
{
|
{
|
||||||
SceneObjectPart child = parts[i];
|
SceneObjectPart child = parts[i];
|
||||||
if (child.PhysActor != null)
|
|
||||||
child.PhysActor.Selected = value;
|
PhysicsActor childPa = child.PhysActor;
|
||||||
|
if (childPa != null)
|
||||||
|
childPa.Selected = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1460,7 +1465,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to duplicate the physics actor as well
|
// Need to duplicate the physics actor as well
|
||||||
if (part.PhysActor != null && userExposed)
|
PhysicsActor originalPartPa = part.PhysActor;
|
||||||
|
if (originalPartPa != null && userExposed)
|
||||||
{
|
{
|
||||||
PrimitiveBaseShape pbs = newPart.Shape;
|
PrimitiveBaseShape pbs = newPart.Shape;
|
||||||
|
|
||||||
|
@ -1471,10 +1477,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
newPart.AbsolutePosition,
|
newPart.AbsolutePosition,
|
||||||
newPart.Scale,
|
newPart.Scale,
|
||||||
newPart.RotationOffset,
|
newPart.RotationOffset,
|
||||||
part.PhysActor.IsPhysical,
|
originalPartPa.IsPhysical,
|
||||||
newPart.LocalId);
|
newPart.LocalId);
|
||||||
|
|
||||||
newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
|
newPart.DoPhysicsPropertyUpdate(originalPartPa.IsPhysical, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1546,45 +1552,53 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (RootPart.PhysActor != null)
|
PhysicsActor pa = RootPart.PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
RootPart.PhysActor.AddForce(impulse, true);
|
pa.AddForce(impulse, true);
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyAngularImpulse(Vector3 impulse)
|
public void applyAngularImpulse(Vector3 impulse)
|
||||||
{
|
{
|
||||||
if (RootPart.PhysActor != null)
|
PhysicsActor pa = RootPart.PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
if (!IsAttachment)
|
if (!IsAttachment)
|
||||||
{
|
{
|
||||||
RootPart.PhysActor.AddAngularForce(impulse, true);
|
pa.AddAngularForce(impulse, true);
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAngularImpulse(Vector3 impulse)
|
public void setAngularImpulse(Vector3 impulse)
|
||||||
{
|
{
|
||||||
if (RootPart.PhysActor != null)
|
PhysicsActor pa = RootPart.PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
if (!IsAttachment)
|
if (!IsAttachment)
|
||||||
{
|
{
|
||||||
RootPart.PhysActor.Torque = impulse;
|
pa.Torque = impulse;
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3 GetTorque()
|
public Vector3 GetTorque()
|
||||||
{
|
{
|
||||||
if (RootPart.PhysActor != null)
|
PhysicsActor pa = RootPart.PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
if (!IsAttachment)
|
if (!IsAttachment)
|
||||||
{
|
{
|
||||||
Vector3 torque = RootPart.PhysActor.Torque;
|
Vector3 torque = pa.Torque;
|
||||||
return torque;
|
return torque;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1604,19 +1618,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (RootPart.PhysActor != null)
|
PhysicsActor pa = RootPart.PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
RootPart.PhysActor.PIDTarget = target;
|
pa.PIDTarget = target;
|
||||||
RootPart.PhysActor.PIDTau = tau;
|
pa.PIDTau = tau;
|
||||||
RootPart.PhysActor.PIDActive = true;
|
pa.PIDActive = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopMoveToTarget()
|
public void stopMoveToTarget()
|
||||||
{
|
{
|
||||||
if (RootPart.PhysActor != null)
|
PhysicsActor pa = RootPart.PhysActor;
|
||||||
RootPart.PhysActor.PIDActive = false;
|
|
||||||
|
if (pa != null)
|
||||||
|
pa.PIDActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1627,18 +1645,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="tau">Number of seconds over which to reach target</param>
|
/// <param name="tau">Number of seconds over which to reach target</param>
|
||||||
public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
|
public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
|
||||||
{
|
{
|
||||||
if (RootPart.PhysActor != null)
|
PhysicsActor pa = RootPart.PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
if (height != 0f)
|
if (height != 0f)
|
||||||
{
|
{
|
||||||
RootPart.PhysActor.PIDHoverHeight = height;
|
pa.PIDHoverHeight = height;
|
||||||
RootPart.PhysActor.PIDHoverType = hoverType;
|
pa.PIDHoverType = hoverType;
|
||||||
RootPart.PhysActor.PIDTau = tau;
|
pa.PIDTau = tau;
|
||||||
RootPart.PhysActor.PIDHoverActive = true;
|
pa.PIDHoverActive = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RootPart.PhysActor.PIDHoverActive = false;
|
pa.PIDHoverActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2105,10 +2125,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
linkPart.ParentID = 0;
|
linkPart.ParentID = 0;
|
||||||
linkPart.LinkNum = 0;
|
linkPart.LinkNum = 0;
|
||||||
|
|
||||||
if (linkPart.PhysActor != null)
|
PhysicsActor linkPartPa = linkPart.PhysActor;
|
||||||
{
|
|
||||||
m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
|
if (linkPartPa != null)
|
||||||
}
|
m_scene.PhysicsScene.RemovePrim(linkPartPa);
|
||||||
|
|
||||||
// We need to reset the child part's position
|
// We need to reset the child part's position
|
||||||
// ready for life as a separate object after being a part of another object
|
// ready for life as a separate object after being a part of another object
|
||||||
|
@ -2199,17 +2219,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
|
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
|
||||||
{
|
{
|
||||||
if (m_rootPart.PhysActor != null)
|
PhysicsActor pa = m_rootPart.PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
if (m_rootPart.PhysActor.IsPhysical)
|
if (pa.IsPhysical)
|
||||||
{
|
{
|
||||||
if (!m_rootPart.BlockGrab)
|
if (!m_rootPart.BlockGrab)
|
||||||
{
|
{
|
||||||
Vector3 llmoveforce = pos - AbsolutePosition;
|
Vector3 llmoveforce = pos - AbsolutePosition;
|
||||||
Vector3 grabforce = llmoveforce;
|
Vector3 grabforce = llmoveforce;
|
||||||
grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
|
grabforce = (grabforce / 10) * pa.Mass;
|
||||||
m_rootPart.PhysActor.AddForce(grabforce, true);
|
pa.AddForce(grabforce, true);
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2239,9 +2261,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (m_scene.EventManager.TriggerGroupSpinStart(UUID))
|
if (m_scene.EventManager.TriggerGroupSpinStart(UUID))
|
||||||
{
|
{
|
||||||
if (m_rootPart.PhysActor != null)
|
PhysicsActor pa = m_rootPart.PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
if (m_rootPart.PhysActor.IsPhysical)
|
if (pa.IsPhysical)
|
||||||
{
|
{
|
||||||
m_rootPart.IsWaitingForFirstSpinUpdatePacket = true;
|
m_rootPart.IsWaitingForFirstSpinUpdatePacket = true;
|
||||||
}
|
}
|
||||||
|
@ -2282,12 +2306,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// but it will result in over-shoot or under-shoot of the target orientation.
|
// but it will result in over-shoot or under-shoot of the target orientation.
|
||||||
// For the end user, this means that ctrl+shift+drag can be used for relative,
|
// For the end user, this means that ctrl+shift+drag can be used for relative,
|
||||||
// but not absolute, adjustments of orientation for physical prims.
|
// but not absolute, adjustments of orientation for physical prims.
|
||||||
|
|
||||||
if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation))
|
if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation))
|
||||||
{
|
{
|
||||||
if (m_rootPart.PhysActor != null)
|
PhysicsActor pa = m_rootPart.PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
if (m_rootPart.PhysActor.IsPhysical)
|
if (pa.IsPhysical)
|
||||||
{
|
{
|
||||||
if (m_rootPart.IsWaitingForFirstSpinUpdatePacket)
|
if (m_rootPart.IsWaitingForFirstSpinUpdatePacket)
|
||||||
{
|
{
|
||||||
|
@ -2313,9 +2338,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
//m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
|
//m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
|
||||||
Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
|
Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
|
||||||
spinforce = (spinforce/8) * m_rootPart.PhysActor.Mass; // 8 is an arbitrary torque scaling factor
|
spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor
|
||||||
m_rootPart.PhysActor.AddAngularForce(spinforce,true);
|
pa.AddAngularForce(spinforce,true);
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2489,8 +2514,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
part.UpdateShape(shapeBlock);
|
part.UpdateShape(shapeBlock);
|
||||||
|
|
||||||
if (part.PhysActor != null)
|
PhysicsActor pa = m_rootPart.PhysActor;
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
|
|
||||||
|
if (pa != null)
|
||||||
|
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2513,7 +2540,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys);
|
scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys);
|
||||||
scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys);
|
scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys);
|
||||||
|
|
||||||
if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical)
|
PhysicsActor pa = m_rootPart.PhysActor;
|
||||||
|
|
||||||
|
if (pa != null && pa.IsPhysical)
|
||||||
{
|
{
|
||||||
scale.X = Math.Min(scale.X, Scene.m_maxPhys);
|
scale.X = Math.Min(scale.X, Scene.m_maxPhys);
|
||||||
scale.Y = Math.Min(scale.Y, Scene.m_maxPhys);
|
scale.Y = Math.Min(scale.Y, Scene.m_maxPhys);
|
||||||
|
@ -2539,7 +2568,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
float f = 1.0f;
|
float f = 1.0f;
|
||||||
float a = 1.0f;
|
float a = 1.0f;
|
||||||
|
|
||||||
if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical)
|
if (pa != null && pa.IsPhysical)
|
||||||
{
|
{
|
||||||
if (oldSize.X * x > m_scene.m_maxPhys)
|
if (oldSize.X * x > m_scene.m_maxPhys)
|
||||||
{
|
{
|
||||||
|
@ -2904,10 +2933,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_rootPart.StoreUndoState();
|
m_rootPart.StoreUndoState();
|
||||||
m_rootPart.UpdateRotation(rot);
|
m_rootPart.UpdateRotation(rot);
|
||||||
if (m_rootPart.PhysActor != null)
|
|
||||||
|
PhysicsActor pa = m_rootPart.PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset;
|
pa.Orientation = m_rootPart.RotationOffset;
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
|
|
|
@ -151,6 +151,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public int[] PayPrice = {-2,-2,-2,-2,-2};
|
public int[] PayPrice = {-2,-2,-2,-2,-2};
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
|
/// <summary>
|
||||||
|
/// The representation of this part in the physics scene.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// If you use this property more than once in a section of code then you must take a reference and use that.
|
||||||
|
/// If another thread is simultaneously turning physics off on this part then this refernece could become
|
||||||
|
/// null at any time.
|
||||||
|
/// </remarks>
|
||||||
public PhysicsActor PhysActor
|
public PhysicsActor PhysActor
|
||||||
{
|
{
|
||||||
get { return m_physActor; }
|
get { return m_physActor; }
|
||||||
|
@ -522,10 +530,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_name = value;
|
m_name = value;
|
||||||
if (PhysActor != null)
|
|
||||||
{
|
PhysicsActor pa = PhysActor;
|
||||||
PhysActor.SOPName = value;
|
|
||||||
}
|
if (pa != null)
|
||||||
|
pa.SOPName = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,10 +544,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_material = (Material)value;
|
m_material = (Material)value;
|
||||||
if (PhysActor != null)
|
|
||||||
{
|
PhysicsActor pa = PhysActor;
|
||||||
PhysActor.SetMaterial((int)value);
|
|
||||||
}
|
if (pa != null)
|
||||||
|
pa.SetMaterial((int)value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,9 +679,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// If this is a linkset, we don't want the physics engine mucking up our group position here.
|
// If this is a linkset, we don't want the physics engine mucking up our group position here.
|
||||||
PhysicsActor actor = PhysActor;
|
PhysicsActor actor = PhysActor;
|
||||||
if (actor != null && ParentID == 0)
|
if (actor != null && ParentID == 0)
|
||||||
{
|
|
||||||
m_groupPosition = actor.Position;
|
m_groupPosition = actor.Position;
|
||||||
}
|
|
||||||
|
|
||||||
if (ParentGroup.IsAttachment)
|
if (ParentGroup.IsAttachment)
|
||||||
{
|
{
|
||||||
|
@ -979,7 +987,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (Shape.SculptEntry)
|
if (Shape.SculptEntry)
|
||||||
CheckSculptAndLoad();
|
CheckSculptAndLoad();
|
||||||
else
|
else
|
||||||
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1505,12 +1513,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basic Physics can also return null as well as an exception catch.
|
// Basic Physics can also return null as well as an exception catch.
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
|
pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
|
||||||
PhysActor.SetMaterial(Material);
|
pa.SetMaterial(Material);
|
||||||
DoPhysicsPropertyUpdate(RigidBody, true);
|
DoPhysicsPropertyUpdate(RigidBody, true);
|
||||||
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
|
pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1734,23 +1744,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
if (UsePhysics != PhysActor.IsPhysical || isNew)
|
if (UsePhysics != pa.IsPhysical || isNew)
|
||||||
{
|
{
|
||||||
if (PhysActor.IsPhysical) // implies UsePhysics==false for this block
|
if (pa.IsPhysical) // implies UsePhysics==false for this block
|
||||||
{
|
{
|
||||||
if (!isNew)
|
if (!isNew)
|
||||||
ParentGroup.Scene.RemovePhysicalPrim(1);
|
ParentGroup.Scene.RemovePhysicalPrim(1);
|
||||||
|
|
||||||
PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
|
pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
|
||||||
PhysActor.OnOutOfBounds -= PhysicsOutOfBounds;
|
pa.OnOutOfBounds -= PhysicsOutOfBounds;
|
||||||
PhysActor.delink();
|
pa.delink();
|
||||||
|
|
||||||
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints && (!isNew))
|
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints && (!isNew))
|
||||||
{
|
{
|
||||||
// destroy all joints connected to this now deactivated body
|
// destroy all joints connected to this now deactivated body
|
||||||
ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(PhysActor);
|
ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop client-side interpolation of all joint proxy objects that have just been deleted
|
// stop client-side interpolation of all joint proxy objects that have just been deleted
|
||||||
|
@ -1769,7 +1781,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//RotationalVelocity = new Vector3(0, 0, 0);
|
//RotationalVelocity = new Vector3(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysActor.IsPhysical = UsePhysics;
|
pa.IsPhysical = UsePhysics;
|
||||||
|
|
||||||
// If we're not what we're supposed to be in the physics scene, recreate ourselves.
|
// If we're not what we're supposed to be in the physics scene, recreate ourselves.
|
||||||
//m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
|
//m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
|
||||||
|
@ -1782,13 +1794,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
ParentGroup.Scene.AddPhysicalPrim(1);
|
ParentGroup.Scene.AddPhysicalPrim(1);
|
||||||
|
|
||||||
PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
|
pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
|
||||||
PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
|
pa.OnOutOfBounds += PhysicsOutOfBounds;
|
||||||
if (ParentID != 0 && ParentID != LocalId)
|
if (ParentID != 0 && ParentID != LocalId)
|
||||||
{
|
{
|
||||||
if (ParentGroup.RootPart.PhysActor != null)
|
PhysicsActor parentPa = ParentGroup.RootPart.PhysActor;
|
||||||
|
|
||||||
|
if (parentPa != null)
|
||||||
{
|
{
|
||||||
PhysActor.link(ParentGroup.RootPart.PhysActor);
|
pa.link(parentPa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1800,7 +1814,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (Shape.SculptEntry)
|
if (Shape.SculptEntry)
|
||||||
CheckSculptAndLoad();
|
CheckSculptAndLoad();
|
||||||
else
|
else
|
||||||
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1911,24 +1925,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public Vector3 GetGeometricCenter()
|
public Vector3 GetGeometricCenter()
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
return new Vector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z);
|
|
||||||
|
if (pa != null)
|
||||||
|
return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z);
|
||||||
else
|
else
|
||||||
return new Vector3(0, 0, 0);
|
return new Vector3(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetMass()
|
public float GetMass()
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
return PhysActor.Mass;
|
|
||||||
|
if (pa != null)
|
||||||
|
return pa.Mass;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3 GetForce()
|
public Vector3 GetForce()
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
return PhysActor.Force;
|
|
||||||
|
if (pa != null)
|
||||||
|
return pa.Force;
|
||||||
else
|
else
|
||||||
return Vector3.Zero;
|
return Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
@ -2559,9 +2579,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void PhysicsRequestingTerseUpdate()
|
public void PhysicsRequestingTerseUpdate()
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0);
|
Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0);
|
||||||
|
|
||||||
if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N)
|
if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N)
|
||||||
| ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S)
|
| ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S)
|
||||||
|
@ -2573,6 +2595,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
//ParentGroup.RootPart.m_groupPosition = newpos;
|
//ParentGroup.RootPart.m_groupPosition = newpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScheduleTerseUpdate();
|
ScheduleTerseUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2663,7 +2686,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys);
|
scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys);
|
||||||
scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys);
|
scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys);
|
||||||
|
|
||||||
if (PhysActor != null && PhysActor.IsPhysical)
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
|
if (pa != null && pa.IsPhysical)
|
||||||
{
|
{
|
||||||
scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys);
|
scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys);
|
||||||
scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys);
|
scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys);
|
||||||
|
@ -2812,12 +2837,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_shape.SculptData = texture.Data;
|
m_shape.SculptData = texture.Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
// Update the physics actor with the new loaded sculpt data and set the taint signal.
|
// Update the physics actor with the new loaded sculpt data and set the taint signal.
|
||||||
PhysActor.Shape = m_shape;
|
pa.Shape = m_shape;
|
||||||
|
|
||||||
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3075,10 +3102,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void SetBuoyancy(float fvalue)
|
public void SetBuoyancy(float fvalue)
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
{
|
|
||||||
PhysActor.Buoyancy = fvalue;
|
if (pa != null)
|
||||||
}
|
pa.Buoyancy = fvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetDieAtEdge(bool p)
|
public void SetDieAtEdge(bool p)
|
||||||
|
@ -3091,57 +3118,50 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void SetFloatOnWater(int floatYN)
|
public void SetFloatOnWater(int floatYN)
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
{
|
|
||||||
if (floatYN == 1)
|
if (pa != null)
|
||||||
{
|
pa.FloatOnWater = floatYN == 1;
|
||||||
PhysActor.FloatOnWater = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PhysActor.FloatOnWater = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetForce(Vector3 force)
|
public void SetForce(Vector3 force)
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
{
|
|
||||||
PhysActor.Force = force;
|
if (pa != null)
|
||||||
}
|
pa.Force = force;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVehicleType(int type)
|
public void SetVehicleType(int type)
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
{
|
|
||||||
PhysActor.VehicleType = type;
|
if (pa != null)
|
||||||
}
|
pa.VehicleType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVehicleFloatParam(int param, float value)
|
public void SetVehicleFloatParam(int param, float value)
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
{
|
|
||||||
PhysActor.VehicleFloatParam(param, value);
|
if (pa != null)
|
||||||
}
|
pa.VehicleFloatParam(param, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVehicleVectorParam(int param, Vector3 value)
|
public void SetVehicleVectorParam(int param, Vector3 value)
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
{
|
|
||||||
PhysActor.VehicleVectorParam(param, value);
|
if (pa != null)
|
||||||
}
|
pa.VehicleVectorParam(param, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVehicleRotationParam(int param, Quaternion rotation)
|
public void SetVehicleRotationParam(int param, Quaternion rotation)
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
{
|
|
||||||
PhysActor.VehicleRotationParam(param, rotation);
|
if (pa != null)
|
||||||
}
|
pa.VehicleRotationParam(param, rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -4229,6 +4249,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD))
|
if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
// Special cases for VD. VD can only be called from a script
|
// Special cases for VD. VD can only be called from a script
|
||||||
// and can't be combined with changes to other states. So we can rely
|
// and can't be combined with changes to other states. So we can rely
|
||||||
// that...
|
// that...
|
||||||
|
@ -4244,8 +4266,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
SetVD = false; // Switch it of for the course of this routine
|
SetVD = false; // Switch it of for the course of this routine
|
||||||
VolumeDetectActive = false; // and also permanently
|
VolumeDetectActive = false; // and also permanently
|
||||||
if (PhysActor != null)
|
|
||||||
PhysActor.SetVolumeDetect(0); // Let physics know about it too
|
if (pa != null)
|
||||||
|
pa.SetVolumeDetect(0); // Let physics know about it too
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4360,9 +4383,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Defensive programming calls for a check here.
|
// Defensive programming calls for a check here.
|
||||||
// Better would be throwing an exception that could be catched by a unit test as the internal
|
// Better would be throwing an exception that could be catched by a unit test as the internal
|
||||||
// logic should make sure, this Physactor is always here.
|
// logic should make sure, this Physactor is always here.
|
||||||
if (this.PhysActor != null)
|
if (pa != null)
|
||||||
{
|
{
|
||||||
PhysActor.SetVolumeDetect(1);
|
pa.SetVolumeDetect(1);
|
||||||
AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
|
AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
|
||||||
this.VolumeDetectActive = true;
|
this.VolumeDetectActive = true;
|
||||||
}
|
}
|
||||||
|
@ -4371,11 +4394,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
// Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
|
// Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
|
||||||
// (mumbles, well, at least if you have infinte CPU powers :-))
|
// (mumbles, well, at least if you have infinte CPU powers :-))
|
||||||
PhysicsActor pa = this.PhysActor;
|
|
||||||
if (pa != null)
|
if (pa != null)
|
||||||
{
|
|
||||||
PhysActor.SetVolumeDetect(0);
|
PhysActor.SetVolumeDetect(0);
|
||||||
}
|
|
||||||
|
|
||||||
this.VolumeDetectActive = false;
|
this.VolumeDetectActive = false;
|
||||||
}
|
}
|
||||||
|
@ -4388,6 +4408,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
RemFlag(PrimFlags.TemporaryOnRez);
|
RemFlag(PrimFlags.TemporaryOnRez);
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
|
// m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
|
||||||
|
|
||||||
if (ParentGroup != null)
|
if (ParentGroup != null)
|
||||||
|
@ -4456,10 +4477,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_shape.PathTwist = shapeBlock.PathTwist;
|
m_shape.PathTwist = shapeBlock.PathTwist;
|
||||||
m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
|
m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
|
||||||
|
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
PhysActor.Shape = m_shape;
|
pa.Shape = m_shape;
|
||||||
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is what makes vehicle trailers work
|
// This is what makes vehicle trailers work
|
||||||
|
@ -4601,6 +4624,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
|
objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
||||||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
|
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
|
||||||
|
@ -4612,18 +4637,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// subscribe to physics updates.
|
// subscribe to physics updates.
|
||||||
if (PhysActor != null)
|
if (pa != null)
|
||||||
{
|
{
|
||||||
PhysActor.OnCollisionUpdate += PhysicsCollision;
|
pa.OnCollisionUpdate += PhysicsCollision;
|
||||||
PhysActor.SubscribeEvents(1000);
|
pa.SubscribeEvents(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
if (pa != null)
|
||||||
{
|
{
|
||||||
PhysActor.UnSubscribeEvents();
|
pa.UnSubscribeEvents();
|
||||||
PhysActor.OnCollisionUpdate -= PhysicsCollision;
|
pa.OnCollisionUpdate -= PhysicsCollision;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue