mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +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;
|
||||
|
||||
Reference in New Issue
Block a user