From d199767e6991d6f368661fce9c5a072e564b8a4b Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sun, 25 Oct 2009 23:16:12 -0700 Subject: Experimental change of PhysicsVector to Vector3. Untested --- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 50 ++++++++++++--------------- 1 file changed, 22 insertions(+), 28 deletions(-) (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs') diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 0eb0c45..2f42646 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -684,7 +684,7 @@ namespace OpenSim.Region.Physics.OdePlugin /// /// /// Returns which split up space the given position is in. - public string whichspaceamIin(PhysicsVector pos) + public string whichspaceamIin(Vector3 pos) { return calculateSpaceForGeom(pos).ToString(); } @@ -963,7 +963,7 @@ namespace OpenSim.Region.Physics.OdePlugin //p2.CollidingObj = true; contacts[i].depth = 0.00000003f; - p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f); + p2.Velocity = p2.Velocity + new Vector3(0f, 0f, 0.5f); contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), contacts[i].pos.Y + (p1.Size.Y/2), @@ -981,7 +981,7 @@ namespace OpenSim.Region.Physics.OdePlugin //p2.CollidingObj = true; contacts[i].depth = 0.00000003f; - p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 0.5f); + p1.Velocity = p1.Velocity + new Vector3(0f, 0f, 0.5f); contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), contacts[i].pos.Y + (p1.Size.Y/2), @@ -1646,9 +1646,9 @@ namespace OpenSim.Region.Physics.OdePlugin #region Add/Remove Entities - public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) + public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) { - PhysicsVector pos = new PhysicsVector(); + Vector3 pos; pos.X = position.X; pos.Y = position.Y; pos.Z = position.Z; @@ -1698,18 +1698,12 @@ namespace OpenSim.Region.Physics.OdePlugin } - private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, + private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) { - - PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z); - //pos.X = position.X; - //pos.Y = position.Y; - //pos.Z = position.Z; - PhysicsVector siz = new PhysicsVector(); - siz.X = size.X; - siz.Y = size.Y; - siz.Z = size.Z; + + Vector3 pos = position; + Vector3 siz = size; Quaternion rot = rotation; OdePrim newPrim; @@ -1736,14 +1730,14 @@ namespace OpenSim.Region.Physics.OdePlugin } } - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, - PhysicsVector size, Quaternion rotation) //To be removed + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation) //To be removed { return AddPrimShape(primName, pbs, position, size, rotation, false); } - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, - PhysicsVector size, Quaternion rotation, bool isPhysical) + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation, bool isPhysical) { PhysicsActor result; IMesh mesh = null; @@ -1976,7 +1970,7 @@ namespace OpenSim.Region.Physics.OdePlugin // 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. - public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position, + public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position, Quaternion rotation, string parms, List bodyNames, string trackedBodyName, Quaternion localRotation) { @@ -1984,7 +1978,7 @@ namespace OpenSim.Region.Physics.OdePlugin OdePhysicsJoint joint = new OdePhysicsJoint(); joint.ObjectNameInScene = objectNameInScene; joint.Type = jointType; - joint.Position = new PhysicsVector(position.X, position.Y, position.Z); + joint.Position = position; joint.Rotation = rotation; joint.RawParams = parms; joint.BodyNames = new List(bodyNames); @@ -2036,7 +2030,7 @@ namespace OpenSim.Region.Physics.OdePlugin } // normally called from within OnJointMoved, which is called from within a lock (OdeLock) - public override PhysicsVector GetJointAnchor(PhysicsJoint joint) + public override Vector3 GetJointAnchor(PhysicsJoint joint) { Debug.Assert(joint.IsInPhysicsEngine); d.Vector3 pos = new d.Vector3(); @@ -2058,14 +2052,14 @@ namespace OpenSim.Region.Physics.OdePlugin break; } } - return new PhysicsVector(pos.X, pos.Y, pos.Z); + return new Vector3(pos.X, pos.Y, pos.Z); } // 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. - public override PhysicsVector GetJointAxis(PhysicsJoint joint) + public override Vector3 GetJointAxis(PhysicsJoint joint) { Debug.Assert(joint.IsInPhysicsEngine); d.Vector3 axis = new d.Vector3(); @@ -2087,7 +2081,7 @@ namespace OpenSim.Region.Physics.OdePlugin break; } } - return new PhysicsVector(axis.X, axis.Y, axis.Z); + return new Vector3(axis.X, axis.Y, axis.Z); } @@ -2255,7 +2249,7 @@ namespace OpenSim.Region.Physics.OdePlugin /// the position that the geom moved to /// a pointer to the space it was in before it was moved. /// a pointer to the new space it's in - public IntPtr recalculateSpaceForGeom(IntPtr geom, PhysicsVector pos, IntPtr currentspace) + public IntPtr recalculateSpaceForGeom(IntPtr geom, Vector3 pos, IntPtr currentspace) { // Called from setting the Position and Size of an ODEPrim so // it's already in locked space. @@ -2402,7 +2396,7 @@ namespace OpenSim.Region.Physics.OdePlugin /// /// /// a pointer to the space. This could be a new space or reused space. - public IntPtr calculateSpaceForGeom(PhysicsVector pos) + public IntPtr calculateSpaceForGeom(Vector3 pos) { int[] xyspace = calculateSpaceArrayItemFromPos(pos); //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); @@ -2414,7 +2408,7 @@ namespace OpenSim.Region.Physics.OdePlugin /// /// /// an array item based on the position - public int[] calculateSpaceArrayItemFromPos(PhysicsVector pos) + public int[] calculateSpaceArrayItemFromPos(Vector3 pos) { int[] returnint = new int[2]; -- cgit v1.1