Experimental change of PhysicsVector to Vector3. Untested

This commit is contained in:
John Hurliman
2009-10-25 23:16:12 -07:00
parent b6651ce790
commit d199767e69
32 changed files with 867 additions and 879 deletions

View File

@@ -684,7 +684,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// </summary>
/// <param name="pos"></param>
/// <returns>Returns which split up space the given position is in.</returns>
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<string> 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<string>(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
/// <param name="pos">the position that the geom moved to</param>
/// <param name="currentspace">a pointer to the space it was in before it was moved.</param>
/// <returns>a pointer to the new space it's in</returns>
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
/// </summary>
/// <param name="pos"></param>
/// <returns>a pointer to the space. This could be a new space or reused space.</returns>
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
/// </summary>
/// <param name="pos"></param>
/// <returns>an array item based on the position</returns>
public int[] calculateSpaceArrayItemFromPos(PhysicsVector pos)
public int[] calculateSpaceArrayItemFromPos(Vector3 pos)
{
int[] returnint = new int[2];