mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
remove some more of obsolete ninha joints code
This commit is contained in:
@@ -785,25 +785,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
get { return m_sceneGraph.PhysicsScene; }
|
||||
set
|
||||
{
|
||||
// If we're not doing the initial set
|
||||
// Then we've got to remove the previous
|
||||
// event handler
|
||||
if (PhysicsScene != null && PhysicsScene.SupportsNINJAJoints)
|
||||
{
|
||||
PhysicsScene.OnJointMoved -= jointMoved;
|
||||
PhysicsScene.OnJointDeactivated -= jointDeactivated;
|
||||
PhysicsScene.OnJointErrorMessage -= jointErrorMessage;
|
||||
}
|
||||
|
||||
m_sceneGraph.PhysicsScene = value;
|
||||
|
||||
if (PhysicsScene != null && m_sceneGraph.PhysicsScene.SupportsNINJAJoints)
|
||||
{
|
||||
// register event handlers to respond to joint movement/deactivation
|
||||
PhysicsScene.OnJointMoved += jointMoved;
|
||||
PhysicsScene.OnJointDeactivated += jointDeactivated;
|
||||
PhysicsScene.OnJointErrorMessage += jointErrorMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2878,11 +2860,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (imm != null)
|
||||
imm.RemovePartMailBox(part.UUID);
|
||||
}
|
||||
if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
|
||||
{
|
||||
PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
|
||||
}
|
||||
else if (part.PhysActor != null)
|
||||
if (part.PhysActor != null)
|
||||
{
|
||||
part.RemoveFromPhysics();
|
||||
}
|
||||
@@ -2991,6 +2969,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// This test is mostly used to see if a region crossing is necessary.
|
||||
// Assuming the position is relative to the region so anything outside its bounds.
|
||||
// Return 'true' if position inside region.
|
||||
|
||||
public bool PositionIsInCurrentRegion(Vector3 pos)
|
||||
{
|
||||
float t = pos.X;
|
||||
@@ -5630,139 +5609,6 @@ Environment.Exit(1);
|
||||
return health;
|
||||
}
|
||||
|
||||
// This callback allows the PhysicsScene to call back to its caller (the SceneGraph) and
|
||||
// update non-physical objects like the joint proxy objects that represent the position
|
||||
// of the joints in the scene.
|
||||
|
||||
// This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene
|
||||
// WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
|
||||
// from within the OdePhysicsScene.
|
||||
|
||||
protected internal void jointMoved(PhysicsJoint joint)
|
||||
{
|
||||
// m_parentScene.PhysicsScene.DumpJointInfo(); // non-thread-locked version; we should already be in a lock (OdeLock) when this callback is invoked
|
||||
SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene);
|
||||
if (jointProxyObject == null)
|
||||
{
|
||||
jointErrorMessage(joint, "WARNING, joint proxy not found, name " + joint.ObjectNameInScene);
|
||||
return;
|
||||
}
|
||||
|
||||
// now update the joint proxy object in the scene to have the position of the joint as returned by the physics engine
|
||||
SceneObjectPart trackedBody = GetSceneObjectPart(joint.TrackedBodyName); // FIXME: causes a sequential lookup
|
||||
if (trackedBody == null) return; // the actor may have been deleted but the joint still lingers around a few frames waiting for deletion. during this time, trackedBody is NULL to prevent further motion of the joint proxy.
|
||||
jointProxyObject.Velocity = trackedBody.Velocity;
|
||||
jointProxyObject.AngularVelocity = trackedBody.AngularVelocity;
|
||||
switch (joint.Type)
|
||||
{
|
||||
case PhysicsJointType.Ball:
|
||||
{
|
||||
Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint);
|
||||
Vector3 proxyPos = jointAnchor;
|
||||
jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
|
||||
}
|
||||
break;
|
||||
|
||||
case PhysicsJointType.Hinge:
|
||||
{
|
||||
Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint);
|
||||
|
||||
// Normally, we would just ask the physics scene to return the axis for the joint.
|
||||
// Unfortunately, ODE sometimes returns <0,0,0> for the joint axis, which should
|
||||
// never occur. Therefore we cannot rely on ODE to always return a correct joint axis.
|
||||
// Therefore the following call does not always work:
|
||||
//PhysicsVector phyJointAxis = _PhyScene.GetJointAxis(joint);
|
||||
|
||||
// instead we compute the joint orientation by saving the original joint orientation
|
||||
// relative to one of the jointed bodies, and applying this transformation
|
||||
// to the current position of the jointed bodies (the tracked body) to compute the
|
||||
// current joint orientation.
|
||||
|
||||
if (joint.TrackedBodyName == null)
|
||||
{
|
||||
jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene);
|
||||
}
|
||||
|
||||
Vector3 proxyPos = jointAnchor;
|
||||
Quaternion q = trackedBody.RotationOffset * joint.LocalRotation;
|
||||
|
||||
jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
|
||||
jointProxyObject.ParentGroup.UpdateGroupRotationR(q); // schedules the entire group for a terse update
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// This callback allows the PhysicsScene to call back to its caller (the SceneGraph) and
|
||||
// update non-physical objects like the joint proxy objects that represent the position
|
||||
// of the joints in the scene.
|
||||
|
||||
// This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene
|
||||
// WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
|
||||
// from within the OdePhysicsScene.
|
||||
protected internal void jointDeactivated(PhysicsJoint joint)
|
||||
{
|
||||
//m_log.Debug("[NINJA] SceneGraph.jointDeactivated, joint:" + joint.ObjectNameInScene);
|
||||
SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene);
|
||||
if (jointProxyObject == null)
|
||||
{
|
||||
jointErrorMessage(joint, "WARNING, trying to deactivate (stop interpolation of) joint proxy, but not found, name " + joint.ObjectNameInScene);
|
||||
return;
|
||||
}
|
||||
|
||||
// turn the proxy non-physical, which also stops its client-side interpolation
|
||||
bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0);
|
||||
if (wasUsingPhysics)
|
||||
{
|
||||
jointProxyObject.UpdatePrimFlags(false, false, true, false,false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock
|
||||
}
|
||||
}
|
||||
|
||||
// This callback allows the PhysicsScene to call back to its caller (the SceneGraph) and
|
||||
// alert the user of errors by using the debug channel in the same way that scripts alert
|
||||
// the user of compile errors.
|
||||
|
||||
// This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene
|
||||
// WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
|
||||
// from within the OdePhysicsScene.
|
||||
public void jointErrorMessage(PhysicsJoint joint, string message)
|
||||
{
|
||||
if (joint != null)
|
||||
{
|
||||
if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages)
|
||||
return;
|
||||
|
||||
SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene);
|
||||
if (jointProxyObject != null)
|
||||
{
|
||||
SimChat(Utils.StringToBytes("[NINJA]: " + message),
|
||||
ChatTypeEnum.DebugChannel,
|
||||
2147483647,
|
||||
jointProxyObject.AbsolutePosition,
|
||||
jointProxyObject.Name,
|
||||
jointProxyObject.UUID,
|
||||
false);
|
||||
|
||||
joint.ErrorMessageCount++;
|
||||
|
||||
if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages)
|
||||
{
|
||||
SimChat(Utils.StringToBytes("[NINJA]: Too many messages for this joint, suppressing further messages."),
|
||||
ChatTypeEnum.DebugChannel,
|
||||
2147483647,
|
||||
jointProxyObject.AbsolutePosition,
|
||||
jointProxyObject.Name,
|
||||
jointProxyObject.UUID,
|
||||
false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// couldn't find the joint proxy object; the error message is silently suppressed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Scene ConsoleScene()
|
||||
{
|
||||
if (MainConsole.Instance == null)
|
||||
@@ -6109,40 +5955,40 @@ Environment.Exit(1);
|
||||
mapModule.GenerateMaptile();
|
||||
}
|
||||
|
||||
// public void CleanDroppedAttachments()
|
||||
// {
|
||||
// List<SceneObjectGroup> objectsToDelete =
|
||||
// new List<SceneObjectGroup>();
|
||||
//
|
||||
// lock (m_cleaningAttachments)
|
||||
// {
|
||||
// ForEachSOG(delegate (SceneObjectGroup grp)
|
||||
// {
|
||||
// if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp)))
|
||||
// {
|
||||
// UUID agentID = grp.OwnerID;
|
||||
// if (agentID == UUID.Zero)
|
||||
// {
|
||||
// objectsToDelete.Add(grp);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// ScenePresence sp = GetScenePresence(agentID);
|
||||
// if (sp == null)
|
||||
// {
|
||||
// objectsToDelete.Add(grp);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// foreach (SceneObjectGroup grp in objectsToDelete)
|
||||
// {
|
||||
// m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID);
|
||||
// DeleteSceneObject(grp, true);
|
||||
// }
|
||||
// }
|
||||
// public void CleanDroppedAttachments()
|
||||
// {
|
||||
// List<SceneObjectGroup> objectsToDelete =
|
||||
// new List<SceneObjectGroup>();
|
||||
//
|
||||
// lock (m_cleaningAttachments)
|
||||
// {
|
||||
// ForEachSOG(delegate (SceneObjectGroup grp)
|
||||
// {
|
||||
// if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp)))
|
||||
// {
|
||||
// UUID agentID = grp.OwnerID;
|
||||
// if (agentID.IsZero())
|
||||
// {
|
||||
// objectsToDelete.Add(grp);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// ScenePresence sp = GetScenePresence(agentID);
|
||||
// if (sp == null)
|
||||
// {
|
||||
// objectsToDelete.Add(grp);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// foreach (SceneObjectGroup grp in objectsToDelete)
|
||||
// {
|
||||
// m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID);
|
||||
// DeleteSceneObject(grp, true);
|
||||
// }
|
||||
// }
|
||||
|
||||
public void ThreadAlive(int threadCode)
|
||||
{
|
||||
|
||||
@@ -2123,24 +2123,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (_VolumeDetectActive)
|
||||
isPhantom = true;
|
||||
|
||||
if (IsJoint())
|
||||
if ((!isPhantom || isPhysical || _VolumeDetectActive)
|
||||
&& !ParentGroup.IsAttachmentCheckFull()
|
||||
&& !(Shape.PathCurve == (byte)Extrusion.Flexible))
|
||||
{
|
||||
DoPhysicsPropertyUpdate(isPhysical, true);
|
||||
AddToPhysics(isPhysical, isPhantom, building, isPhysical);
|
||||
UpdatePhysicsSubscribedEvents(); // not sure if appliable here
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((!isPhantom || isPhysical || _VolumeDetectActive)
|
||||
&& !ParentGroup.IsAttachmentCheckFull()
|
||||
&& !(Shape.PathCurve == (byte)Extrusion.Flexible))
|
||||
{
|
||||
AddToPhysics(isPhysical, isPhantom, building, isPhysical);
|
||||
UpdatePhysicsSubscribedEvents(); // not sure if appliable here
|
||||
}
|
||||
else
|
||||
{
|
||||
PhysActor = null; // just to be sure
|
||||
RemFlag(PrimFlags.CameraDecoupled);
|
||||
}
|
||||
PhysActor = null; // just to be sure
|
||||
RemFlag(PrimFlags.CameraDecoupled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2246,98 +2239,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return dupe;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Do a physics property update for a NINJA joint.
|
||||
/// </summary>
|
||||
/// <param name="UsePhysics"></param>
|
||||
/// <param name="isNew"></param>
|
||||
protected void DoPhysicsPropertyUpdateForNinjaJoint(bool UsePhysics, bool isNew)
|
||||
{
|
||||
if (UsePhysics)
|
||||
{
|
||||
// by turning a joint proxy object physical, we cause creation of a joint in the ODE scene.
|
||||
// note that, as a special case, joints have no bodies or geoms in the physics scene, even though they are physical.
|
||||
|
||||
PhysicsJointType jointType;
|
||||
if (IsHingeJoint())
|
||||
{
|
||||
jointType = PhysicsJointType.Hinge;
|
||||
}
|
||||
else if (IsBallJoint())
|
||||
{
|
||||
jointType = PhysicsJointType.Ball;
|
||||
}
|
||||
else
|
||||
{
|
||||
jointType = PhysicsJointType.Ball;
|
||||
}
|
||||
|
||||
List<string> bodyNames = new List<string>();
|
||||
string RawParams = Description;
|
||||
string[] jointParams = RawParams.Split(" ".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);
|
||||
string trackedBodyName = null;
|
||||
if (jointParams.Length >= 2)
|
||||
{
|
||||
for (int iBodyName = 0; iBodyName < 2; iBodyName++)
|
||||
{
|
||||
string bodyName = jointParams[iBodyName];
|
||||
bodyNames.Add(bodyName);
|
||||
if (bodyName != "NULL")
|
||||
{
|
||||
if (trackedBodyName == null)
|
||||
{
|
||||
trackedBodyName = bodyName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SceneObjectPart trackedBody = ParentGroup.Scene.GetSceneObjectPart(trackedBodyName); // FIXME: causes a sequential lookup
|
||||
Quaternion localRotation = Quaternion.Identity;
|
||||
if (trackedBody != null)
|
||||
{
|
||||
localRotation = Quaternion.Inverse(trackedBody.RotationOffset) * this.RotationOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
// error, output it below
|
||||
}
|
||||
|
||||
PhysicsJoint joint;
|
||||
|
||||
joint = ParentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType,
|
||||
AbsolutePosition,
|
||||
this.RotationOffset,
|
||||
Description,
|
||||
bodyNames,
|
||||
trackedBodyName,
|
||||
localRotation);
|
||||
|
||||
if (trackedBody == null)
|
||||
{
|
||||
ParentGroup.Scene.jointErrorMessage(joint, "warning: tracked body name not found! joint location will not be updated properly. joint: " + Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isNew)
|
||||
{
|
||||
// if the joint proxy is new, and it is not physical, do nothing. There is no joint in ODE to
|
||||
// delete, and if we try to delete it, due to asynchronous processing, the deletion request
|
||||
// will get processed later at an indeterminate time, which could cancel a later-arriving
|
||||
// joint creation request.
|
||||
}
|
||||
else
|
||||
{
|
||||
// here we turn off the joint object, so remove the joint from the physics scene
|
||||
ParentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed?
|
||||
|
||||
// make sure client isn't interpolating the joint proxy object
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Do a physics propery update for this part.
|
||||
/// now also updates phantom and volume detector
|
||||
@@ -2352,92 +2253,75 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
|
||||
return;
|
||||
|
||||
if (IsJoint())
|
||||
{
|
||||
DoPhysicsPropertyUpdateForNinjaJoint(UsePhysics, isNew);
|
||||
}
|
||||
else
|
||||
{
|
||||
PhysicsActor pa = PhysActor;
|
||||
PhysicsActor pa = PhysActor;
|
||||
|
||||
if (pa != null)
|
||||
if (pa != null)
|
||||
{
|
||||
if (UsePhysics != pa.IsPhysical)
|
||||
ClampScale(UsePhysics);
|
||||
|
||||
if (UsePhysics != pa.IsPhysical || isNew)
|
||||
{
|
||||
if (UsePhysics != pa.IsPhysical)
|
||||
ClampScale(UsePhysics);
|
||||
|
||||
if (UsePhysics != pa.IsPhysical || isNew)
|
||||
if (pa.IsPhysical) // implies UsePhysics==false for this block
|
||||
{
|
||||
if (pa.IsPhysical) // implies UsePhysics==false for this block
|
||||
if (!isNew) // implies UsePhysics==false for this block
|
||||
{
|
||||
if (!isNew) // implies UsePhysics==false for this block
|
||||
ParentGroup.Scene.RemovePhysicalPrim(1);
|
||||
|
||||
Stop();
|
||||
|
||||
if (pa.Phantom && !VolumeDetectActive)
|
||||
{
|
||||
ParentGroup.Scene.RemovePhysicalPrim(1);
|
||||
|
||||
Stop();
|
||||
|
||||
if (pa.Phantom && !VolumeDetectActive)
|
||||
{
|
||||
RemoveFromPhysics();
|
||||
return;
|
||||
}
|
||||
|
||||
pa.IsPhysical = UsePhysics;
|
||||
pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
|
||||
pa.OnOutOfBounds -= PhysicsOutOfBounds;
|
||||
pa.delink();
|
||||
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||
{
|
||||
// destroy all joints connected to this now deactivated body
|
||||
ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(pa);
|
||||
}
|
||||
RemoveFromPhysics();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (pa.IsPhysical != UsePhysics)
|
||||
pa.IsPhysical = UsePhysics;
|
||||
|
||||
if (UsePhysics)
|
||||
{
|
||||
if (ParentGroup.RootPart.KeyframeMotion != null)
|
||||
ParentGroup.RootPart.KeyframeMotion.Stop();
|
||||
ParentGroup.RootPart.KeyframeMotion = null;
|
||||
ParentGroup.Scene.AddPhysicalPrim(1);
|
||||
|
||||
PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
|
||||
PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
|
||||
|
||||
if (_parentID != 0 && _parentID != LocalId)
|
||||
{
|
||||
PhysicsActor parentPa = ParentGroup.RootPart.PhysActor;
|
||||
|
||||
if (parentPa != null)
|
||||
{
|
||||
pa.link(parentPa);
|
||||
}
|
||||
}
|
||||
pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
|
||||
pa.OnOutOfBounds -= PhysicsOutOfBounds;
|
||||
pa.delink();
|
||||
}
|
||||
}
|
||||
|
||||
bool phan = ((m_flags & PrimFlags.Phantom) != 0);
|
||||
if (pa.Phantom != phan)
|
||||
pa.Phantom = phan;
|
||||
if (pa.IsPhysical != UsePhysics)
|
||||
pa.IsPhysical = UsePhysics;
|
||||
|
||||
// some engines dont' have this check still
|
||||
// if (VolumeDetectActive != pa.IsVolumeDtc)
|
||||
if (UsePhysics)
|
||||
{
|
||||
if (VolumeDetectActive)
|
||||
pa.SetVolumeDetect(1);
|
||||
else
|
||||
pa.SetVolumeDetect(0);
|
||||
}
|
||||
if (ParentGroup.RootPart.KeyframeMotion != null)
|
||||
ParentGroup.RootPart.KeyframeMotion.Stop();
|
||||
ParentGroup.RootPart.KeyframeMotion = null;
|
||||
ParentGroup.Scene.AddPhysicalPrim(1);
|
||||
|
||||
// If this part is a sculpt then delay the physics update until we've asynchronously loaded the
|
||||
// mesh data.
|
||||
// if (Shape.SculptEntry)
|
||||
// CheckSculptAndLoad();
|
||||
// else
|
||||
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||
PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
|
||||
PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
|
||||
|
||||
if (_parentID != 0 && _parentID != LocalId)
|
||||
{
|
||||
PhysicsActor parentPa = ParentGroup.RootPart.PhysActor;
|
||||
|
||||
if (parentPa != null)
|
||||
{
|
||||
pa.link(parentPa);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool phan = ((m_flags & PrimFlags.Phantom) != 0);
|
||||
if (pa.Phantom != phan)
|
||||
pa.Phantom = phan;
|
||||
|
||||
// some engines dont' have this check still
|
||||
// if (VolumeDetectActive != pa.IsVolumeDtc)
|
||||
{
|
||||
if (VolumeDetectActive)
|
||||
pa.SetVolumeDetect(1);
|
||||
else
|
||||
pa.SetVolumeDetect(0);
|
||||
}
|
||||
|
||||
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4758,53 +4642,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SendFullUpdateToAllClients();
|
||||
}
|
||||
|
||||
public bool IsHingeJoint()
|
||||
{
|
||||
// For now, we use the NINJA naming scheme for identifying joints.
|
||||
// In the future, we can support other joint specification schemes such as a
|
||||
// custom checkbox in the viewer GUI.
|
||||
if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||
{
|
||||
string hingeString = "hingejoint";
|
||||
return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsBallJoint()
|
||||
{
|
||||
// For now, we use the NINJA naming scheme for identifying joints.
|
||||
// In the future, we can support other joint specification schemes such as a
|
||||
// custom checkbox in the viewer GUI.
|
||||
if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||
{
|
||||
string ballString = "balljoint";
|
||||
return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsJoint()
|
||||
{
|
||||
// For now, we use the NINJA naming scheme for identifying joints.
|
||||
// In the future, we can support other joint specification schemes such as a
|
||||
// custom checkbox in the viewer GUI.
|
||||
if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||
{
|
||||
return IsHingeJoint() || IsBallJoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateExtraPhysics(ExtraPhysicsData physdata)
|
||||
{
|
||||
if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null)
|
||||
@@ -4972,7 +4809,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (pa != null)
|
||||
{
|
||||
pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
|
||||
pa.SOPName = Name;
|
||||
pa.SetMaterial(Material);
|
||||
|
||||
pa.Density = Density;
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.PhysicsModules.SharedBase;
|
||||
|
||||
namespace OpenSim.Region.PhysicsModule.ODE
|
||||
{
|
||||
class OdePhysicsJoint : PhysicsJoint
|
||||
{
|
||||
public override bool IsInPhysicsEngine
|
||||
{
|
||||
get
|
||||
{
|
||||
return (jointID != IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
public IntPtr jointID;
|
||||
}
|
||||
}
|
||||
@@ -404,34 +404,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||
/// </remarks>
|
||||
private readonly List<OdeCharacter> defects = new List<OdeCharacter>();
|
||||
|
||||
private bool m_NINJA_physics_joints_enabled = false;
|
||||
//private Dictionary<String, IntPtr> jointpart_name_map = new Dictionary<String,IntPtr>();
|
||||
private readonly Dictionary<String, List<PhysicsJoint>> joints_connecting_actor = new Dictionary<String, List<PhysicsJoint>>();
|
||||
private SafeNativeMethods.ContactGeom[] contacts;
|
||||
|
||||
/// <summary>
|
||||
/// Lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active
|
||||
/// </summary>
|
||||
private readonly List<PhysicsJoint> requestedJointsToBeCreated = new List<PhysicsJoint>();
|
||||
|
||||
/// <summary>
|
||||
/// can lock for longer. accessed only by OdeScene.
|
||||
/// </summary>
|
||||
private readonly List<PhysicsJoint> pendingJoints = new List<PhysicsJoint>();
|
||||
|
||||
/// <summary>
|
||||
/// can lock for longer. accessed only by OdeScene.
|
||||
/// </summary>
|
||||
private readonly List<PhysicsJoint> activeJoints = new List<PhysicsJoint>();
|
||||
|
||||
/// <summary>
|
||||
/// lock only briefly. accessed by external code (to request deletion of joints) and by OdeScene.Simulate() to move those joints out of pending/active
|
||||
/// </summary>
|
||||
private readonly List<string> requestedJointsToBeDeleted = new List<string>();
|
||||
|
||||
private Object externalJointRequestsLock = new Object();
|
||||
private readonly Dictionary<String, PhysicsJoint> SOPName_to_activeJoint = new Dictionary<String, PhysicsJoint>();
|
||||
private readonly Dictionary<String, PhysicsJoint> SOPName_to_pendingJoint = new Dictionary<String, PhysicsJoint>();
|
||||
private readonly DoubleDictionary<Vector3, IntPtr, IntPtr> RegionTerrain = new DoubleDictionary<Vector3, IntPtr, IntPtr>();
|
||||
private readonly Dictionary<IntPtr,float[]> TerrainHeightFieldHeights = new Dictionary<IntPtr, float[]>();
|
||||
|
||||
@@ -644,7 +618,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||
physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0);
|
||||
physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false);
|
||||
|
||||
// m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false);
|
||||
minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f);
|
||||
maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", 10000.01f);
|
||||
}
|
||||
@@ -1821,357 +1794,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||
get { return m_timeDilation; }
|
||||
}
|
||||
|
||||
public override bool SupportsNINJAJoints
|
||||
{
|
||||
get { return m_NINJA_physics_joints_enabled; }
|
||||
}
|
||||
|
||||
// internal utility function: must be called within a lock (OdeLock)
|
||||
private void InternalAddActiveJoint(PhysicsJoint joint)
|
||||
{
|
||||
activeJoints.Add(joint);
|
||||
SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint);
|
||||
}
|
||||
|
||||
// internal utility function: must be called within a lock (OdeLock)
|
||||
private void InternalAddPendingJoint(OdePhysicsJoint joint)
|
||||
{
|
||||
pendingJoints.Add(joint);
|
||||
SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint);
|
||||
}
|
||||
|
||||
// internal utility function: must be called within a lock (OdeLock)
|
||||
private void InternalRemovePendingJoint(PhysicsJoint joint)
|
||||
{
|
||||
pendingJoints.Remove(joint);
|
||||
SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene);
|
||||
}
|
||||
|
||||
// internal utility function: must be called within a lock (OdeLock)
|
||||
private void InternalRemoveActiveJoint(PhysicsJoint joint)
|
||||
{
|
||||
activeJoints.Remove(joint);
|
||||
SOPName_to_activeJoint.Remove(joint.ObjectNameInScene);
|
||||
}
|
||||
|
||||
public override void DumpJointInfo()
|
||||
{
|
||||
string hdr = "[NINJA] JOINTINFO: ";
|
||||
foreach (PhysicsJoint j in pendingJoints)
|
||||
{
|
||||
m_log.Debug(hdr + " pending joint, Name: " + j.ObjectNameInScene + " raw parms:" + j.RawParams);
|
||||
}
|
||||
m_log.Debug(hdr + pendingJoints.Count + " total pending joints");
|
||||
foreach (string jointName in SOPName_to_pendingJoint.Keys)
|
||||
{
|
||||
m_log.Debug(hdr + " pending joints dict contains Name: " + jointName);
|
||||
}
|
||||
m_log.Debug(hdr + SOPName_to_pendingJoint.Keys.Count + " total pending joints dict entries");
|
||||
foreach (PhysicsJoint j in activeJoints)
|
||||
{
|
||||
m_log.Debug(hdr + " active joint, Name: " + j.ObjectNameInScene + " raw parms:" + j.RawParams);
|
||||
}
|
||||
m_log.Debug(hdr + activeJoints.Count + " total active joints");
|
||||
foreach (string jointName in SOPName_to_activeJoint.Keys)
|
||||
{
|
||||
m_log.Debug(hdr + " active joints dict contains Name: " + jointName);
|
||||
}
|
||||
m_log.Debug(hdr + SOPName_to_activeJoint.Keys.Count + " total active joints dict entries");
|
||||
|
||||
m_log.Debug(hdr + " Per-body joint connectivity information follows.");
|
||||
m_log.Debug(hdr + joints_connecting_actor.Keys.Count + " bodies are connected by joints.");
|
||||
foreach (string actorName in joints_connecting_actor.Keys)
|
||||
{
|
||||
m_log.Debug(hdr + " Actor " + actorName + " has the following joints connecting it");
|
||||
foreach (PhysicsJoint j in joints_connecting_actor[actorName])
|
||||
{
|
||||
m_log.Debug(hdr + " * joint Name: " + j.ObjectNameInScene + " raw parms:" + j.RawParams);
|
||||
}
|
||||
m_log.Debug(hdr + joints_connecting_actor[actorName].Count + " connecting joints total for this actor");
|
||||
}
|
||||
}
|
||||
|
||||
public override void RequestJointDeletion(string ObjectNameInScene)
|
||||
{
|
||||
lock (externalJointRequestsLock)
|
||||
{
|
||||
if (!requestedJointsToBeDeleted.Contains(ObjectNameInScene)) // forbid same deletion request from entering twice to prevent spurious deletions processed asynchronously
|
||||
{
|
||||
requestedJointsToBeDeleted.Add(ObjectNameInScene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteRequestedJoints()
|
||||
{
|
||||
List<string> myRequestedJointsToBeDeleted;
|
||||
lock (externalJointRequestsLock)
|
||||
{
|
||||
// make a local copy of the shared list for processing (threading issues)
|
||||
myRequestedJointsToBeDeleted = new List<string>(requestedJointsToBeDeleted);
|
||||
}
|
||||
|
||||
foreach (string jointName in myRequestedJointsToBeDeleted)
|
||||
{
|
||||
lock (OdeLock)
|
||||
{
|
||||
//m_log.Debug("[NINJA] trying to deleting requested joint " + jointName);
|
||||
if (SOPName_to_activeJoint.ContainsKey(jointName) || SOPName_to_pendingJoint.ContainsKey(jointName))
|
||||
{
|
||||
OdePhysicsJoint joint = null;
|
||||
if (SOPName_to_activeJoint.ContainsKey(jointName))
|
||||
{
|
||||
joint = SOPName_to_activeJoint[jointName] as OdePhysicsJoint;
|
||||
InternalRemoveActiveJoint(joint);
|
||||
}
|
||||
else if (SOPName_to_pendingJoint.ContainsKey(jointName))
|
||||
{
|
||||
joint = SOPName_to_pendingJoint[jointName] as OdePhysicsJoint;
|
||||
InternalRemovePendingJoint(joint);
|
||||
}
|
||||
|
||||
if (joint != null)
|
||||
{
|
||||
//m_log.Debug("joint.BodyNames.Count is " + joint.BodyNames.Count + " and contents " + joint.BodyNames);
|
||||
for (int iBodyName = 0; iBodyName < 2; iBodyName++)
|
||||
{
|
||||
string bodyName = joint.BodyNames[iBodyName];
|
||||
if (bodyName != "NULL")
|
||||
{
|
||||
joints_connecting_actor[bodyName].Remove(joint);
|
||||
if (joints_connecting_actor[bodyName].Count == 0)
|
||||
{
|
||||
joints_connecting_actor.Remove(bodyName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DoJointDeactivated(joint);
|
||||
if (joint.jointID != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.JointDestroy(joint.jointID);
|
||||
joint.jointID = IntPtr.Zero;
|
||||
//DoJointErrorMessage(joint, "successfully destroyed joint " + jointName);
|
||||
}
|
||||
else
|
||||
{
|
||||
//m_log.Warn("[NINJA] Ignoring re-request to destroy joint " + jointName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// DoJointErrorMessage(joint, "coult not find joint to destroy based on name " + jointName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// DoJointErrorMessage(joint, "WARNING - joint removal failed, joint " + jointName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove processed joints from the shared list
|
||||
lock (externalJointRequestsLock)
|
||||
{
|
||||
foreach (string jointName in myRequestedJointsToBeDeleted)
|
||||
{
|
||||
requestedJointsToBeDeleted.Remove(jointName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for pending joints we don't know if their associated bodies exist yet or not.
|
||||
// the joint is actually created during processing of the taints
|
||||
private void CreateRequestedJoints()
|
||||
{
|
||||
List<PhysicsJoint> myRequestedJointsToBeCreated;
|
||||
lock (externalJointRequestsLock)
|
||||
{
|
||||
// make a local copy of the shared list for processing (threading issues)
|
||||
myRequestedJointsToBeCreated = new List<PhysicsJoint>(requestedJointsToBeCreated);
|
||||
}
|
||||
|
||||
foreach (PhysicsJoint joint in myRequestedJointsToBeCreated)
|
||||
{
|
||||
lock (OdeLock)
|
||||
{
|
||||
if (SOPName_to_pendingJoint.ContainsKey(joint.ObjectNameInScene) && SOPName_to_pendingJoint[joint.ObjectNameInScene] != null)
|
||||
{
|
||||
DoJointErrorMessage(joint, "WARNING: ignoring request to re-add already pending joint Name:" + joint.ObjectNameInScene + " type:" + joint.Type + " parms: " + joint.RawParams + " pos: " + joint.Position + " rot:" + joint.Rotation);
|
||||
continue;
|
||||
}
|
||||
if (SOPName_to_activeJoint.ContainsKey(joint.ObjectNameInScene) && SOPName_to_activeJoint[joint.ObjectNameInScene] != null)
|
||||
{
|
||||
DoJointErrorMessage(joint, "WARNING: ignoring request to re-add already active joint Name:" + joint.ObjectNameInScene + " type:" + joint.Type + " parms: " + joint.RawParams + " pos: " + joint.Position + " rot:" + joint.Rotation);
|
||||
continue;
|
||||
}
|
||||
|
||||
InternalAddPendingJoint(joint as OdePhysicsJoint);
|
||||
|
||||
if (joint.BodyNames.Count >= 2)
|
||||
{
|
||||
for (int iBodyName = 0; iBodyName < 2; iBodyName++)
|
||||
{
|
||||
string bodyName = joint.BodyNames[iBodyName];
|
||||
if (bodyName != "NULL")
|
||||
{
|
||||
if (!joints_connecting_actor.ContainsKey(bodyName))
|
||||
{
|
||||
joints_connecting_actor.Add(bodyName, new List<PhysicsJoint>());
|
||||
}
|
||||
joints_connecting_actor[bodyName].Add(joint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove processed joints from shared list
|
||||
lock (externalJointRequestsLock)
|
||||
{
|
||||
foreach (PhysicsJoint joint in myRequestedJointsToBeCreated)
|
||||
{
|
||||
requestedJointsToBeCreated.Remove(joint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a request for joint creation.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// this joint will just be added to a waiting list that is NOT processed during the main
|
||||
/// Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests.
|
||||
/// </remarks>
|
||||
/// <param name="objectNameInScene"></param>
|
||||
/// <param name="jointType"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="rotation"></param>
|
||||
/// <param name="parms"></param>
|
||||
/// <param name="bodyNames"></param>
|
||||
/// <param name="trackedBodyName"></param>
|
||||
/// <param name="localRotation"></param>
|
||||
/// <returns></returns>
|
||||
public override PhysicsJoint RequestJointCreation(
|
||||
string objectNameInScene, PhysicsJointType jointType, Vector3 position,
|
||||
Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation)
|
||||
{
|
||||
OdePhysicsJoint joint = new OdePhysicsJoint();
|
||||
joint.ObjectNameInScene = objectNameInScene;
|
||||
joint.Type = jointType;
|
||||
joint.Position = position;
|
||||
joint.Rotation = rotation;
|
||||
joint.RawParams = parms;
|
||||
joint.BodyNames = new List<string>(bodyNames);
|
||||
joint.TrackedBodyName = trackedBodyName;
|
||||
joint.LocalRotation = localRotation;
|
||||
joint.jointID = IntPtr.Zero;
|
||||
joint.ErrorMessageCount = 0;
|
||||
|
||||
lock (externalJointRequestsLock)
|
||||
{
|
||||
if (!requestedJointsToBeCreated.Contains(joint)) // forbid same creation request from entering twice
|
||||
{
|
||||
requestedJointsToBeCreated.Add(joint);
|
||||
}
|
||||
}
|
||||
|
||||
return joint;
|
||||
}
|
||||
|
||||
private void RemoveAllJointsConnectedToActor(PhysicsActor actor)
|
||||
{
|
||||
//m_log.Debug("RemoveAllJointsConnectedToActor: start");
|
||||
if (actor.SOPName != null && joints_connecting_actor.ContainsKey(actor.SOPName) && joints_connecting_actor[actor.SOPName] != null)
|
||||
{
|
||||
List<PhysicsJoint> jointsToRemove = new List<PhysicsJoint>();
|
||||
//TODO: merge these 2 loops (originally it was needed to avoid altering a list being iterated over, but it is no longer needed due to the joint request queue mechanism)
|
||||
foreach (PhysicsJoint j in joints_connecting_actor[actor.SOPName])
|
||||
{
|
||||
jointsToRemove.Add(j);
|
||||
}
|
||||
foreach (PhysicsJoint j in jointsToRemove)
|
||||
{
|
||||
//m_log.Debug("RemoveAllJointsConnectedToActor: about to request deletion of " + j.ObjectNameInScene);
|
||||
RequestJointDeletion(j.ObjectNameInScene);
|
||||
//m_log.Debug("RemoveAllJointsConnectedToActor: done request deletion of " + j.ObjectNameInScene);
|
||||
j.TrackedBodyName = null; // *IMMEDIATELY* prevent any further movement of this joint (else a deleted actor might cause spurious tracking motion of the joint for a few frames, leading to the joint proxy object disappearing)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void RemoveAllJointsConnectedToActorThreadLocked(PhysicsActor actor)
|
||||
{
|
||||
//m_log.Debug("RemoveAllJointsConnectedToActorThreadLocked: start");
|
||||
lock (OdeLock)
|
||||
{
|
||||
//m_log.Debug("RemoveAllJointsConnectedToActorThreadLocked: got lock");
|
||||
RemoveAllJointsConnectedToActor(actor);
|
||||
}
|
||||
}
|
||||
|
||||
// normally called from within OnJointMoved, which is called from within a lock (OdeLock)
|
||||
public override Vector3 GetJointAnchor(PhysicsJoint joint)
|
||||
{
|
||||
Debug.Assert(joint.IsInPhysicsEngine);
|
||||
SafeNativeMethods.Vector3 pos = new SafeNativeMethods.Vector3();
|
||||
|
||||
if (!(joint is OdePhysicsJoint))
|
||||
{
|
||||
DoJointErrorMessage(joint, "warning: non-ODE joint requesting anchor: " + joint.ObjectNameInScene);
|
||||
}
|
||||
else
|
||||
{
|
||||
OdePhysicsJoint odeJoint = (OdePhysicsJoint)joint;
|
||||
switch (odeJoint.Type)
|
||||
{
|
||||
case PhysicsJointType.Ball:
|
||||
SafeNativeMethods.JointGetBallAnchor(odeJoint.jointID, out pos);
|
||||
break;
|
||||
case PhysicsJointType.Hinge:
|
||||
SafeNativeMethods.JointGetHingeAnchor(odeJoint.jointID, out pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new Vector3(pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get joint axis.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// normally called from within OnJointMoved, which is called from within a lock (OdeLock)
|
||||
/// WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function
|
||||
/// appears to be unreliable. Fortunately we can compute the joint axis ourselves by
|
||||
/// keeping track of the joint's original orientation relative to one of the involved bodies.
|
||||
/// </remarks>
|
||||
/// <param name="joint"></param>
|
||||
/// <returns></returns>
|
||||
public override Vector3 GetJointAxis(PhysicsJoint joint)
|
||||
{
|
||||
Debug.Assert(joint.IsInPhysicsEngine);
|
||||
SafeNativeMethods.Vector3 axis = new SafeNativeMethods.Vector3();
|
||||
|
||||
if (!(joint is OdePhysicsJoint))
|
||||
{
|
||||
DoJointErrorMessage(joint, "warning: non-ODE joint requesting anchor: " + joint.ObjectNameInScene);
|
||||
}
|
||||
else
|
||||
{
|
||||
OdePhysicsJoint odeJoint = (OdePhysicsJoint)joint;
|
||||
switch (odeJoint.Type)
|
||||
{
|
||||
case PhysicsJointType.Ball:
|
||||
DoJointErrorMessage(joint, "warning - axis requested for ball joint: " + joint.ObjectNameInScene);
|
||||
break;
|
||||
case PhysicsJointType.Hinge:
|
||||
SafeNativeMethods.JointGetHingeAxis(odeJoint.jointID, out axis);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new Vector3(axis.X, axis.Y, axis.Z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop this prim being subject to physics
|
||||
/// </summary>
|
||||
@@ -2240,10 +1862,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||
|
||||
lock (_prims)
|
||||
_prims.Remove(prim);
|
||||
|
||||
|
||||
if (SupportsNINJAJoints)
|
||||
RemoveAllJointsConnectedToActorThreadLocked(prim);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2709,13 +2327,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||
m_collisionEventActorsChanges.Clear();
|
||||
}
|
||||
|
||||
if (SupportsNINJAJoints)
|
||||
{
|
||||
DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
|
||||
CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
|
||||
}
|
||||
|
||||
|
||||
lock (OdeLock)
|
||||
{
|
||||
SafeNativeMethods.AllocateODEDataForThread(~0U);
|
||||
@@ -2766,9 +2377,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||
//Watchdog.UpdateThread();
|
||||
}
|
||||
|
||||
if (SupportsNINJAJoints)
|
||||
SimulatePendingNINJAJoints();
|
||||
|
||||
_taintedPrims.Clear();
|
||||
}
|
||||
|
||||
@@ -2926,9 +2534,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||
if (prim.IsPhysical && (SafeNativeMethods.BodyIsEnabled(prim.Body) || !prim._zeroFlag))
|
||||
{
|
||||
prim.UpdatePositionAndVelocity();
|
||||
|
||||
if (SupportsNINJAJoints)
|
||||
SimulateActorPendingJoints(prim);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2983,229 +2588,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||
return fps;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Simulate pending NINJA joints.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Called by the main Simulate() loop if NINJA joints are active. Should not be called from anywhere else.
|
||||
/// </remarks>
|
||||
private void SimulatePendingNINJAJoints()
|
||||
{
|
||||
// Create pending joints, if possible
|
||||
|
||||
// joints can only be processed after ALL bodies are processed (and exist in ODE), since creating
|
||||
// a joint requires specifying the body id of both involved bodies
|
||||
if (pendingJoints.Count > 0)
|
||||
{
|
||||
List<PhysicsJoint> successfullyProcessedPendingJoints = new List<PhysicsJoint>();
|
||||
//DoJointErrorMessage(joints_connecting_actor, "taint: " + pendingJoints.Count + " pending joints");
|
||||
foreach (PhysicsJoint joint in pendingJoints)
|
||||
{
|
||||
//DoJointErrorMessage(joint, "taint: time to create joint with parms: " + joint.RawParams);
|
||||
string[] jointParams = joint.RawParams.Split(" ".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);
|
||||
List<IntPtr> jointBodies = new List<IntPtr>();
|
||||
bool allJointBodiesAreReady = true;
|
||||
foreach (string jointParam in jointParams)
|
||||
{
|
||||
if (jointParam == "NULL")
|
||||
{
|
||||
//DoJointErrorMessage(joint, "attaching NULL joint to world");
|
||||
jointBodies.Add(IntPtr.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
//DoJointErrorMessage(joint, "looking for prim name: " + jointParam);
|
||||
bool foundPrim = false;
|
||||
lock (_prims)
|
||||
{
|
||||
foreach (OdePrim prim in _prims) // FIXME: inefficient
|
||||
{
|
||||
if (prim.SOPName == jointParam)
|
||||
{
|
||||
//DoJointErrorMessage(joint, "found for prim name: " + jointParam);
|
||||
if (prim.IsPhysical && prim.Body != IntPtr.Zero)
|
||||
{
|
||||
jointBodies.Add(prim.Body);
|
||||
foundPrim = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
DoJointErrorMessage(joint, "prim name " + jointParam +
|
||||
" exists but is not (yet) physical; deferring joint creation. " +
|
||||
"IsPhysical property is " + prim.IsPhysical +
|
||||
" and body is " + prim.Body);
|
||||
foundPrim = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (foundPrim)
|
||||
{
|
||||
// all is fine
|
||||
}
|
||||
else
|
||||
{
|
||||
allJointBodiesAreReady = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allJointBodiesAreReady)
|
||||
{
|
||||
//DoJointErrorMessage(joint, "allJointBodiesAreReady for " + joint.ObjectNameInScene + " with parms " + joint.RawParams);
|
||||
if (jointBodies[0] == jointBodies[1])
|
||||
{
|
||||
DoJointErrorMessage(joint, "ERROR: joint cannot be created; the joint bodies are the same, body1==body2. Raw body is " + jointBodies[0] + ". raw parms: " + joint.RawParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (joint.Type)
|
||||
{
|
||||
case PhysicsJointType.Ball:
|
||||
{
|
||||
IntPtr odeJoint;
|
||||
//DoJointErrorMessage(joint, "ODE creating ball joint ");
|
||||
odeJoint = SafeNativeMethods.JointCreateBall(world, IntPtr.Zero);
|
||||
//DoJointErrorMessage(joint, "ODE attaching ball joint: " + odeJoint + " with b1:" + jointBodies[0] + " b2:" + jointBodies[1]);
|
||||
SafeNativeMethods.JointAttach(odeJoint, jointBodies[0], jointBodies[1]);
|
||||
//DoJointErrorMessage(joint, "ODE setting ball anchor: " + odeJoint + " to vec:" + joint.Position);
|
||||
SafeNativeMethods.JointSetBallAnchor(odeJoint,
|
||||
joint.Position.X,
|
||||
joint.Position.Y,
|
||||
joint.Position.Z);
|
||||
//DoJointErrorMessage(joint, "ODE joint setting OK");
|
||||
//DoJointErrorMessage(joint, "The ball joint's bodies are here: b0: ");
|
||||
//DoJointErrorMessage(joint, "" + (jointBodies[0] != IntPtr.Zero ? "" + d.BodyGetPosition(jointBodies[0]) : "fixed environment"));
|
||||
//DoJointErrorMessage(joint, "The ball joint's bodies are here: b1: ");
|
||||
//DoJointErrorMessage(joint, "" + (jointBodies[1] != IntPtr.Zero ? "" + d.BodyGetPosition(jointBodies[1]) : "fixed environment"));
|
||||
|
||||
if (joint is OdePhysicsJoint)
|
||||
{
|
||||
((OdePhysicsJoint)joint).jointID = odeJoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
DoJointErrorMessage(joint, "WARNING: non-ode joint in ODE!");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PhysicsJointType.Hinge:
|
||||
{
|
||||
IntPtr odeJoint;
|
||||
//DoJointErrorMessage(joint, "ODE creating hinge joint ");
|
||||
odeJoint = SafeNativeMethods.JointCreateHinge(world, IntPtr.Zero);
|
||||
//DoJointErrorMessage(joint, "ODE attaching hinge joint: " + odeJoint + " with b1:" + jointBodies[0] + " b2:" + jointBodies[1]);
|
||||
SafeNativeMethods.JointAttach(odeJoint, jointBodies[0], jointBodies[1]);
|
||||
//DoJointErrorMessage(joint, "ODE setting hinge anchor: " + odeJoint + " to vec:" + joint.Position);
|
||||
SafeNativeMethods.JointSetHingeAnchor(odeJoint,
|
||||
joint.Position.X,
|
||||
joint.Position.Y,
|
||||
joint.Position.Z);
|
||||
// We use the orientation of the x-axis of the joint's coordinate frame
|
||||
// as the axis for the hinge.
|
||||
|
||||
// Therefore, we must get the joint's coordinate frame based on the
|
||||
// joint.Rotation field, which originates from the orientation of the
|
||||
// joint's proxy object in the scene.
|
||||
|
||||
// The joint's coordinate frame is defined as the transformation matrix
|
||||
// that converts a vector from joint-local coordinates into world coordinates.
|
||||
// World coordinates are defined as the XYZ coordinate system of the sim,
|
||||
// as shown in the top status-bar of the viewer.
|
||||
|
||||
// Once we have the joint's coordinate frame, we extract its X axis (AtAxis)
|
||||
// and use that as the hinge axis.
|
||||
|
||||
//joint.Rotation.Normalize();
|
||||
Matrix4 proxyFrame = Matrix4.CreateFromQuaternion(joint.Rotation);
|
||||
|
||||
// Now extract the X axis of the joint's coordinate frame.
|
||||
|
||||
// Do not try to use proxyFrame.AtAxis or you will become mired in the
|
||||
// tar pit of transposed, inverted, and generally messed-up orientations.
|
||||
// (In other words, Matrix4.AtAxis() is borked.)
|
||||
// Vector3 jointAxis = proxyFrame.AtAxis; <--- this path leadeth to madness
|
||||
|
||||
// Instead, compute the X axis of the coordinate frame by transforming
|
||||
// the (1,0,0) vector. At least that works.
|
||||
|
||||
//m_log.Debug("PHY: making axis: complete matrix is " + proxyFrame);
|
||||
Vector3 jointAxis = Vector3.Transform(Vector3.UnitX, proxyFrame);
|
||||
//m_log.Debug("PHY: making axis: hinge joint axis is " + jointAxis);
|
||||
//DoJointErrorMessage(joint, "ODE setting hinge axis: " + odeJoint + " to vec:" + jointAxis);
|
||||
SafeNativeMethods.JointSetHingeAxis(odeJoint,
|
||||
jointAxis.X,
|
||||
jointAxis.Y,
|
||||
jointAxis.Z);
|
||||
//d.JointSetHingeParam(odeJoint, (int)dParam.CFM, 0.1f);
|
||||
if (joint is OdePhysicsJoint)
|
||||
{
|
||||
((OdePhysicsJoint)joint).jointID = odeJoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
DoJointErrorMessage(joint, "WARNING: non-ode joint in ODE!");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
successfullyProcessedPendingJoints.Add(joint);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DoJointErrorMessage(joint, "joint could not yet be created; still pending");
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PhysicsJoint successfullyProcessedJoint in successfullyProcessedPendingJoints)
|
||||
{
|
||||
//DoJointErrorMessage(successfullyProcessedJoint, "finalizing succesfully procsssed joint " + successfullyProcessedJoint.ObjectNameInScene + " parms " + successfullyProcessedJoint.RawParams);
|
||||
//DoJointErrorMessage(successfullyProcessedJoint, "removing from pending");
|
||||
InternalRemovePendingJoint(successfullyProcessedJoint);
|
||||
//DoJointErrorMessage(successfullyProcessedJoint, "adding to active");
|
||||
InternalAddActiveJoint(successfullyProcessedJoint);
|
||||
//DoJointErrorMessage(successfullyProcessedJoint, "done");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Simulate the joint proxies of a NINJA actor.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Called as part of the Simulate() loop if NINJA physics is active. Must only be called from there.
|
||||
/// </remarks>
|
||||
/// <param name="actor"></param>
|
||||
private void SimulateActorPendingJoints(OdePrim actor)
|
||||
{
|
||||
// If an actor moved, move its joint proxy objects as well.
|
||||
// There seems to be an event PhysicsActor.OnPositionUpdate that could be used
|
||||
// for this purpose but it is never called! So we just do the joint
|
||||
// movement code here.
|
||||
|
||||
if (actor.SOPName != null &&
|
||||
joints_connecting_actor.ContainsKey(actor.SOPName) &&
|
||||
joints_connecting_actor[actor.SOPName] != null &&
|
||||
joints_connecting_actor[actor.SOPName].Count > 0)
|
||||
{
|
||||
foreach (PhysicsJoint affectedJoint in joints_connecting_actor[actor.SOPName])
|
||||
{
|
||||
if (affectedJoint.IsInPhysicsEngine)
|
||||
{
|
||||
DoJointMoved(affectedJoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoJointErrorMessage(affectedJoint, "a body connected to a joint was moved, but the joint doesn't exist yet! this will lead to joint error. joint was: " + affectedJoint.ObjectNameInScene + " parms:" + affectedJoint.RawParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetTerrain(float[] heightMap)
|
||||
{
|
||||
if (m_worldOffset != Vector3.Zero && m_parentScene != null)
|
||||
|
||||
@@ -228,69 +228,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
|
||||
get { return 1.0f; }
|
||||
}
|
||||
|
||||
public virtual bool SupportsNINJAJoints
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position,
|
||||
Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation)
|
||||
{ return null; }
|
||||
|
||||
public virtual void RequestJointDeletion(string objectNameInScene)
|
||||
{ return; }
|
||||
|
||||
public virtual void RemoveAllJointsConnectedToActorThreadLocked(PhysicsActor actor)
|
||||
{ return; }
|
||||
|
||||
public virtual void DumpJointInfo()
|
||||
{ return; }
|
||||
|
||||
public event JointMoved OnJointMoved;
|
||||
|
||||
protected virtual void DoJointMoved(PhysicsJoint joint)
|
||||
{
|
||||
// We need this to allow subclasses (but not other classes) to invoke the event; C# does
|
||||
// not allow subclasses to invoke the parent class event.
|
||||
if (OnJointMoved != null)
|
||||
{
|
||||
OnJointMoved(joint);
|
||||
}
|
||||
}
|
||||
|
||||
public event JointDeactivated OnJointDeactivated;
|
||||
|
||||
protected virtual void DoJointDeactivated(PhysicsJoint joint)
|
||||
{
|
||||
// We need this to allow subclasses (but not other classes) to invoke the event; C# does
|
||||
// not allow subclasses to invoke the parent class event.
|
||||
if (OnJointDeactivated != null)
|
||||
{
|
||||
OnJointDeactivated(joint);
|
||||
}
|
||||
}
|
||||
|
||||
public event JointErrorMessage OnJointErrorMessage;
|
||||
|
||||
protected virtual void DoJointErrorMessage(PhysicsJoint joint, string message)
|
||||
{
|
||||
// We need this to allow subclasses (but not other classes) to invoke the event; C# does
|
||||
// not allow subclasses to invoke the parent class event.
|
||||
if (OnJointErrorMessage != null)
|
||||
{
|
||||
OnJointErrorMessage(joint, message);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Vector3 GetJointAnchor(PhysicsJoint joint)
|
||||
{ return Vector3.Zero; }
|
||||
|
||||
public virtual Vector3 GetJointAxis(PhysicsJoint joint)
|
||||
{ return Vector3.Zero; }
|
||||
|
||||
public abstract void AddPhysicsActorTaint(PhysicsActor prim);
|
||||
|
||||
|
||||
public virtual void ProcessPreSimulation() { }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -487,7 +487,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if ((functionControl & AllowedControlFlags.PARCEL_OWNER) != 0)
|
||||
{
|
||||
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
|
||||
if (land.LandData.OwnerID == ownerID)
|
||||
if (land.LandData.OwnerID.Equals(ownerID))
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
@@ -507,7 +507,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if ((functionControl & AllowedControlFlags.ESTATE_MANAGER) != 0)
|
||||
{
|
||||
//Only Estate Managers may use the function
|
||||
if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID)
|
||||
if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner.NotEqual(ownerID))
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
@@ -516,7 +516,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
//Only regionowners may use the function
|
||||
if ((functionControl & AllowedControlFlags.ESTATE_OWNER) != 0)
|
||||
{
|
||||
if (World.RegionInfo.EstateSettings.EstateOwner == ownerID)
|
||||
if (World.RegionInfo.EstateSettings.EstateOwner.Equals(ownerID))
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
@@ -559,7 +559,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.",
|
||||
function));
|
||||
|
||||
if (m_item.CreatorID != ownerID)
|
||||
if (m_item.CreatorID.NotEqual(ownerID))
|
||||
{
|
||||
if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0)
|
||||
return String.Format("{0} permission denied. Script creator is not prim owner.", function);
|
||||
@@ -956,10 +956,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
UUID hostOwner = m_host.OwnerID;
|
||||
|
||||
if(hostOwner == agentId)
|
||||
if(hostOwner.Equals(agentId))
|
||||
return true;
|
||||
|
||||
if (m_item.PermsGranter == agentId)
|
||||
if (m_item.PermsGranter.Equals(agentId))
|
||||
{
|
||||
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0)
|
||||
return true;
|
||||
@@ -973,7 +973,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if(landdata == null)
|
||||
return true;
|
||||
|
||||
if(landdata.OwnerID == hostOwner)
|
||||
if(landdata.OwnerID.Equals(hostOwner))
|
||||
return true;
|
||||
|
||||
EstateSettings es = World.RegionInfo.EstateSettings;
|
||||
@@ -987,7 +987,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if(landGroup.IsZero())
|
||||
return false;
|
||||
|
||||
if(landGroup == m_host.GroupID)
|
||||
if(landGroup.Equals(m_host.GroupID))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -1868,7 +1868,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
|
||||
case ScriptBaseClass.PARCEL_DETAILS_GROUP:
|
||||
if(m_host.OwnerID == newLand.OwnerID || es == null || es.IsEstateManagerOrOwner(m_host.OwnerID))
|
||||
if(m_host.OwnerID.Equals(newLand.OwnerID) || es == null || es.IsEstateManagerOrOwner(m_host.OwnerID))
|
||||
{
|
||||
if (UUID.TryParse(arg, out uuid))
|
||||
{
|
||||
@@ -1962,7 +1962,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (avatar == null || avatar.IsDeleted || avatar.IsInTransit)
|
||||
return;
|
||||
|
||||
if(changedSeeAvs && avatar.currentParcelUUID == parcelID )
|
||||
if(changedSeeAvs && avatar.currentParcelUUID.Equals(parcelID))
|
||||
avatar.currentParcelUUID = parcelID; // force parcel flags review
|
||||
|
||||
if(avatar.ControllingClient == null)
|
||||
@@ -2199,14 +2199,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return;
|
||||
|
||||
// harakiri check
|
||||
if(sceneOG.UUID == m_host.ParentGroup.UUID)
|
||||
if(sceneOG.UUID.Equals(m_host.ParentGroup.UUID))
|
||||
{
|
||||
m_LSL_Api.llDie();
|
||||
return;
|
||||
}
|
||||
|
||||
// restrict to objects rezzed by host
|
||||
if(sceneOG.RezzerID == m_host.ParentGroup.UUID)
|
||||
if(sceneOG.RezzerID.Equals(m_host.ParentGroup.UUID))
|
||||
World.DeleteSceneObject(sceneOG, false);
|
||||
}
|
||||
|
||||
@@ -2544,9 +2544,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
if (uInfo != null)
|
||||
{
|
||||
if (Util.ParseUniversalUserIdentifier(uInfo.UserID, out UUID userUUID,
|
||||
out string gridURL, out string firstName,
|
||||
out string lastName, out string tmp))
|
||||
if (Util.ParseFullUniversalUserIdentifier(uInfo.UserID, out UUID userUUID,
|
||||
out string gridURL, out string firstName, out string lastName))
|
||||
{
|
||||
string grid = new Uri(gridURL).Authority;
|
||||
return firstName + "." + lastName + " @" + grid;
|
||||
@@ -4949,7 +4948,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return true;
|
||||
|
||||
UUID hostOwner = m_host.OwnerID;
|
||||
if(landdata.OwnerID == hostOwner)
|
||||
if(landdata.OwnerID.Equals(hostOwner))
|
||||
return true;
|
||||
|
||||
EstateSettings es = World.RegionInfo.EstateSettings;
|
||||
@@ -4963,7 +4962,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if(landGroup.IsZero())
|
||||
return false;
|
||||
|
||||
if(landGroup == m_host.GroupID)
|
||||
if(landGroup.Equals(m_host.GroupID))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -4999,7 +4998,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if(sog== null || sog.IsDeleted || sog.inTransit)
|
||||
return -1;
|
||||
|
||||
if(sog.OwnerID != m_host.OwnerID)
|
||||
if(sog.OwnerID.NotEqual(m_host.OwnerID))
|
||||
{
|
||||
Vector3 pos = sog.AbsolutePosition;
|
||||
if(!checkAllowObjectTPbyLandOwner(pos))
|
||||
@@ -5675,7 +5674,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
foreach(TaskInventoryItem script in scripts)
|
||||
{
|
||||
if(script.ItemID == me)
|
||||
if(script.ItemID.Equals(me))
|
||||
continue;
|
||||
m_ScriptEngine.ResetScript(script.ItemID);
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
List<string> toremove = new List<string>(DataserverRequests.Count);
|
||||
foreach (DataserverRequest ds in DataserverRequests.Values)
|
||||
{
|
||||
if (ds.itemID == itemID)
|
||||
if (ds.itemID.Equals(itemID))
|
||||
toremove.Add(ds.handle);
|
||||
}
|
||||
foreach (string s in toremove)
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
|
||||
foreach (TimerInfo ts in tvals)
|
||||
{
|
||||
if (ts.itemID == itemID)
|
||||
if (ts.itemID.Equals(itemID))
|
||||
{
|
||||
data.Add(ts.interval);
|
||||
data.Add(ts.next-DateTime.Now.Ticks);
|
||||
|
||||
@@ -429,7 +429,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ent.Velocity.Equals(ZeroVector))
|
||||
if (ent.Velocity.IsZero())
|
||||
{
|
||||
objtype |= PASSIVE; // Passive non-moving
|
||||
}
|
||||
@@ -560,7 +560,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
|
||||
// if the object the script is in is attached and the avatar is the owner
|
||||
// then this one is not wanted
|
||||
if (attached && presence.UUID == SensePoint.OwnerID)
|
||||
if (attached && presence.UUID.Equals(SensePoint.OwnerID))
|
||||
return;
|
||||
|
||||
toRegionPos = presence.AbsolutePosition;
|
||||
|
||||
Reference in New Issue
Block a user