From ec2dc354b485491d7879686b4a78027971e3ed92 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 26 Dec 2008 12:58:02 +0000 Subject: * Applying Nlin's NINJA Joint patch. v2. Mantis# 2874 * Thanks nlin! * To try it out, set ninja joints active in the ODEPhysicsSettings and use the example at: * http://forge.opensimulator.org/gf/download/frsrelease/142/304/demo-playground.tgz. * Don't forget to change the .tgz to .oar and load it with load-oar. --- OpenSim/Region/Physics/Manager/PhysicsScene.cs | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'OpenSim/Region/Physics/Manager/PhysicsScene.cs') diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index f104632..2cf4d5a 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -73,6 +73,67 @@ namespace OpenSim.Region.Physics.Manager public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation, bool isPhysical); + public virtual bool SupportsNINJAJoints + { + get { return false; } + } + + public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position, + Quaternion rotation, string parms, List 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 PhysicsVector GetJointAnchor(PhysicsJoint joint) + { return null; } + + public virtual PhysicsVector GetJointAxis(PhysicsJoint joint) + { return null; } + + public abstract void AddPhysicsActorTaint(PhysicsActor prim); public abstract float Simulate(float timeStep); @@ -181,4 +242,7 @@ namespace OpenSim.Region.Physics.Manager } } } + public delegate void JointMoved(PhysicsJoint joint); + public delegate void JointDeactivated(PhysicsJoint joint); + public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation" } -- cgit v1.1