aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-25 23:16:12 -0700
committerJohn Hurliman2009-10-26 18:23:43 -0700
commitd199767e6991d6f368661fce9c5a072e564b8a4b (patch)
treed9347b8a424c0164e208f908613aa8fe1511444b /OpenSim/Region
parent* Double the priority on avatar bake texture requests to get avatars rezzing ... (diff)
downloadopensim-SC-d199767e6991d6f368661fce9c5a072e564b8a4b.zip
opensim-SC-d199767e6991d6f368661fce9c5a072e564b8a4b.tar.gz
opensim-SC-d199767e6991d6f368661fce9c5a072e564b8a4b.tar.bz2
opensim-SC-d199767e6991d6f368661fce9c5a072e564b8a4b.tar.xz
Experimental change of PhysicsVector to Vector3. Untested
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs46
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs18
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs42
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs54
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs40
-rw-r--r--OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs96
-rw-r--r--OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs257
-rw-r--r--OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs12
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs158
-rw-r--r--OpenSim/Region/Physics/Manager/IMesher.cs7
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs86
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsJoint.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs32
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsSensor.cs7
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsVector.cs28
-rw-r--r--OpenSim/Region/Physics/Manager/ZeroMesher.cs5
-rw-r--r--OpenSim/Region/Physics/Meshing/HelperTypes.cs62
-rw-r--r--OpenSim/Region/Physics/Meshing/Mesh.cs7
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs21
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs113
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs269
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs50
-rw-r--r--OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs4
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSCharacter.cs55
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPrim.cs53
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSScene.cs52
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs122
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs8
32 files changed, 866 insertions, 878 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 53c64cb..93a949a 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -264,10 +264,8 @@ namespace OpenSim.Region.CoreModules.World.Land
264 avatar.ControllingClient.SendAlertMessage( 264 avatar.ControllingClient.SendAlertMessage(
265 "You are not allowed on this parcel because you are banned. Please go away."); 265 "You are not allowed on this parcel because you are banned. Please go away.");
266 266
267 avatar.PhysicsActor.Position = 267 avatar.PhysicsActor.Position = avatar.lastKnownAllowedPosition;
268 new PhysicsVector(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y, 268 avatar.PhysicsActor.Velocity = Vector3.Zero;
269 avatar.lastKnownAllowedPosition.Z);
270 avatar.PhysicsActor.Velocity = new PhysicsVector(0, 0, 0);
271 } 269 }
272 else 270 else
273 { 271 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7eafef7..6c34056 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4606,7 +4606,7 @@ namespace OpenSim.Region.Framework.Scenes
4606 { 4606 {
4607 case PhysicsJointType.Ball: 4607 case PhysicsJointType.Ball:
4608 { 4608 {
4609 PhysicsVector jointAnchor = PhysicsScene.GetJointAnchor(joint); 4609 Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint);
4610 Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); 4610 Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z);
4611 jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update 4611 jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
4612 } 4612 }
@@ -4614,7 +4614,7 @@ namespace OpenSim.Region.Framework.Scenes
4614 4614
4615 case PhysicsJointType.Hinge: 4615 case PhysicsJointType.Hinge:
4616 { 4616 {
4617 PhysicsVector jointAnchor = PhysicsScene.GetJointAnchor(joint); 4617 Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint);
4618 4618
4619 // Normally, we would just ask the physics scene to return the axis for the joint. 4619 // Normally, we would just ask the physics scene to return the axis for the joint.
4620 // Unfortunately, ODE sometimes returns <0,0,0> for the joint axis, which should 4620 // Unfortunately, ODE sometimes returns <0,0,0> for the joint axis, which should
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 34ada4c..38a0cff 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1479,8 +1479,8 @@ namespace OpenSim.Region.Framework.Scenes
1479 dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( 1479 dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
1480 dupe.RootPart.Name, 1480 dupe.RootPart.Name,
1481 pbs, 1481 pbs,
1482 new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, dupe.RootPart.AbsolutePosition.Z), 1482 dupe.RootPart.AbsolutePosition,
1483 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z), 1483 dupe.RootPart.Scale,
1484 dupe.RootPart.RotationOffset, 1484 dupe.RootPart.RotationOffset,
1485 dupe.RootPart.PhysActor.IsPhysical); 1485 dupe.RootPart.PhysActor.IsPhysical);
1486 1486
@@ -1595,7 +1595,7 @@ namespace OpenSim.Region.Framework.Scenes
1595 */ 1595 */
1596 } 1596 }
1597 1597
1598 public void applyImpulse(PhysicsVector impulse) 1598 public void applyImpulse(Vector3 impulse)
1599 { 1599 {
1600 // We check if rootpart is null here because scripts don't delete if you delete the host. 1600 // We check if rootpart is null here because scripts don't delete if you delete the host.
1601 // This means that unfortunately, we can pass a null physics actor to Simulate! 1601 // This means that unfortunately, we can pass a null physics actor to Simulate!
@@ -1622,7 +1622,7 @@ namespace OpenSim.Region.Framework.Scenes
1622 } 1622 }
1623 } 1623 }
1624 1624
1625 public void applyAngularImpulse(PhysicsVector impulse) 1625 public void applyAngularImpulse(Vector3 impulse)
1626 { 1626 {
1627 // We check if rootpart is null here because scripts don't delete if you delete the host. 1627 // We check if rootpart is null here because scripts don't delete if you delete the host.
1628 // This means that unfortunately, we can pass a null physics actor to Simulate! 1628 // This means that unfortunately, we can pass a null physics actor to Simulate!
@@ -1641,7 +1641,7 @@ namespace OpenSim.Region.Framework.Scenes
1641 } 1641 }
1642 } 1642 }
1643 1643
1644 public void setAngularImpulse(PhysicsVector impulse) 1644 public void setAngularImpulse(Vector3 impulse)
1645 { 1645 {
1646 // We check if rootpart is null here because scripts don't delete if you delete the host. 1646 // We check if rootpart is null here because scripts don't delete if you delete the host.
1647 // This means that unfortunately, we can pass a null physics actor to Simulate! 1647 // This means that unfortunately, we can pass a null physics actor to Simulate!
@@ -1672,8 +1672,8 @@ namespace OpenSim.Region.Framework.Scenes
1672 { 1672 {
1673 if (!IsAttachment) 1673 if (!IsAttachment)
1674 { 1674 {
1675 PhysicsVector torque = rootpart.PhysActor.Torque; 1675 Vector3 torque = rootpart.PhysActor.Torque;
1676 return new Vector3(torque.X, torque.Y, torque.Z); 1676 return torque;
1677 } 1677 }
1678 } 1678 }
1679 } 1679 }
@@ -1706,7 +1706,7 @@ namespace OpenSim.Region.Framework.Scenes
1706 { 1706 {
1707 if (rootpart.PhysActor != null) 1707 if (rootpart.PhysActor != null)
1708 { 1708 {
1709 rootpart.PhysActor.PIDTarget = new PhysicsVector(target.X, target.Y, target.Z); 1709 rootpart.PhysActor.PIDTarget = target;
1710 rootpart.PhysActor.PIDTau = tau; 1710 rootpart.PhysActor.PIDTau = tau;
1711 rootpart.PhysActor.PIDActive = true; 1711 rootpart.PhysActor.PIDActive = true;
1712 } 1712 }
@@ -2374,7 +2374,7 @@ namespace OpenSim.Region.Framework.Scenes
2374 if (m_rootPart.PhysActor.IsPhysical) 2374 if (m_rootPart.PhysActor.IsPhysical)
2375 { 2375 {
2376 Vector3 llmoveforce = pos - AbsolutePosition; 2376 Vector3 llmoveforce = pos - AbsolutePosition;
2377 PhysicsVector grabforce = new PhysicsVector(llmoveforce.X, llmoveforce.Y, llmoveforce.Z); 2377 Vector3 grabforce = llmoveforce;
2378 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; 2378 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
2379 m_rootPart.PhysActor.AddForce(grabforce,true); 2379 m_rootPart.PhysActor.AddForce(grabforce,true);
2380 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2380 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
@@ -2479,7 +2479,7 @@ namespace OpenSim.Region.Framework.Scenes
2479 rotationAxis.Normalize(); 2479 rotationAxis.Normalize();
2480 2480
2481 //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis); 2481 //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
2482 PhysicsVector spinforce = new PhysicsVector(rotationAxis.X, rotationAxis.Y, rotationAxis.Z); 2482 Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
2483 spinforce = (spinforce/8) * m_rootPart.PhysActor.Mass; // 8 is an arbitrary torque scaling factor 2483 spinforce = (spinforce/8) * m_rootPart.PhysActor.Mass; // 8 is an arbitrary torque scaling factor
2484 m_rootPart.PhysActor.AddAngularForce(spinforce,true); 2484 m_rootPart.PhysActor.AddAngularForce(spinforce,true);
2485 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2485 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
@@ -2706,8 +2706,7 @@ namespace OpenSim.Region.Framework.Scenes
2706 if (scale.Z > m_scene.m_maxPhys) 2706 if (scale.Z > m_scene.m_maxPhys)
2707 scale.Z = m_scene.m_maxPhys; 2707 scale.Z = m_scene.m_maxPhys;
2708 } 2708 }
2709 part.PhysActor.Size = 2709 part.PhysActor.Size = scale;
2710 new PhysicsVector(scale.X, scale.Y, scale.Z);
2711 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); 2710 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
2712 } 2711 }
2713 //if (part.UUID != m_rootPart.UUID) 2712 //if (part.UUID != m_rootPart.UUID)
@@ -2851,8 +2850,7 @@ namespace OpenSim.Region.Framework.Scenes
2851 2850
2852 if (part.PhysActor != null) 2851 if (part.PhysActor != null)
2853 { 2852 {
2854 part.PhysActor.Size = 2853 part.PhysActor.Size = prevScale;
2855 new PhysicsVector(prevScale.X, prevScale.Y, prevScale.Z);
2856 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); 2854 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
2857 } 2855 }
2858 2856
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index a87bde0..70f3112 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -167,9 +167,9 @@ namespace OpenSim.Region.Framework.Scenes
167 167
168 [XmlIgnore] 168 [XmlIgnore]
169 public uint AttachmentPoint; 169 public uint AttachmentPoint;
170 170
171 [XmlIgnore] 171 [XmlIgnore]
172 public PhysicsVector RotationAxis = new PhysicsVector(1f, 1f, 1f); 172 public Vector3 RotationAxis = Vector3.One;
173 173
174 [XmlIgnore] 174 [XmlIgnore]
175 public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this 175 public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this
@@ -537,13 +537,13 @@ namespace OpenSim.Region.Framework.Scenes
537 // Root prim actually goes at Position 537 // Root prim actually goes at Position
538 if (_parentID == 0) 538 if (_parentID == 0)
539 { 539 {
540 PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); 540 PhysActor.Position = value;
541 } 541 }
542 else 542 else
543 { 543 {
544 // To move the child prim in respect to the group position and rotation we have to calculate 544 // To move the child prim in respect to the group position and rotation we have to calculate
545 Vector3 resultingposition = GetWorldPosition(); 545 Vector3 resultingposition = GetWorldPosition();
546 PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); 546 PhysActor.Position = resultingposition;
547 Quaternion resultingrot = GetWorldRotation(); 547 Quaternion resultingrot = GetWorldRotation();
548 PhysActor.Orientation = resultingrot; 548 PhysActor.Orientation = resultingrot;
549 } 549 }
@@ -585,7 +585,7 @@ namespace OpenSim.Region.Framework.Scenes
585 if (_parentID != 0 && PhysActor != null) 585 if (_parentID != 0 && PhysActor != null)
586 { 586 {
587 Vector3 resultingposition = GetWorldPosition(); 587 Vector3 resultingposition = GetWorldPosition();
588 PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); 588 PhysActor.Position = resultingposition;
589 Quaternion resultingrot = GetWorldRotation(); 589 Quaternion resultingrot = GetWorldRotation();
590 PhysActor.Orientation = resultingrot; 590 PhysActor.Orientation = resultingrot;
591 591
@@ -675,7 +675,7 @@ namespace OpenSim.Region.Framework.Scenes
675 { 675 {
676 if (PhysActor.IsPhysical) 676 if (PhysActor.IsPhysical)
677 { 677 {
678 PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); 678 PhysActor.Velocity = value;
679 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 679 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
680 } 680 }
681 } 681 }
@@ -817,7 +817,7 @@ if (m_shape != null) {
817 { 817 {
818 if (m_parentGroup.Scene.PhysicsScene != null) 818 if (m_parentGroup.Scene.PhysicsScene != null)
819 { 819 {
820 PhysActor.Size = new PhysicsVector(m_shape.Scale.X, m_shape.Scale.Y, m_shape.Scale.Z); 820 PhysActor.Size = m_shape.Scale;
821 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 821 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
822 } 822 }
823 } 823 }
@@ -1225,7 +1225,7 @@ if (m_shape != null) {
1225 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> 1225 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
1226 public void ApplyImpulse(Vector3 impulsei, bool localGlobalTF) 1226 public void ApplyImpulse(Vector3 impulsei, bool localGlobalTF)
1227 { 1227 {
1228 PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); 1228 Vector3 impulse = impulsei;
1229 1229
1230 if (localGlobalTF) 1230 if (localGlobalTF)
1231 { 1231 {
@@ -1233,7 +1233,7 @@ if (m_shape != null) {
1233 Quaternion AXgrot = grot; 1233 Quaternion AXgrot = grot;
1234 Vector3 AXimpulsei = impulsei; 1234 Vector3 AXimpulsei = impulsei;
1235 Vector3 newimpulse = AXimpulsei * AXgrot; 1235 Vector3 newimpulse = AXimpulsei * AXgrot;
1236 impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z); 1236 impulse = newimpulse;
1237 } 1237 }
1238 1238
1239 if (m_parentGroup != null) 1239 if (m_parentGroup != null)
@@ -1251,7 +1251,7 @@ if (m_shape != null) {
1251 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> 1251 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
1252 public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF) 1252 public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF)
1253 { 1253 {
1254 PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); 1254 Vector3 impulse = impulsei;
1255 1255
1256 if (localGlobalTF) 1256 if (localGlobalTF)
1257 { 1257 {
@@ -1259,7 +1259,7 @@ if (m_shape != null) {
1259 Quaternion AXgrot = grot; 1259 Quaternion AXgrot = grot;
1260 Vector3 AXimpulsei = impulsei; 1260 Vector3 AXimpulsei = impulsei;
1261 Vector3 newimpulse = AXimpulsei * AXgrot; 1261 Vector3 newimpulse = AXimpulsei * AXgrot;
1262 impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z); 1262 impulse = newimpulse;
1263 } 1263 }
1264 1264
1265 if (m_parentGroup != null) 1265 if (m_parentGroup != null)
@@ -1277,7 +1277,7 @@ if (m_shape != null) {
1277 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> 1277 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
1278 public void SetAngularImpulse(Vector3 impulsei, bool localGlobalTF) 1278 public void SetAngularImpulse(Vector3 impulsei, bool localGlobalTF)
1279 { 1279 {
1280 PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); 1280 Vector3 impulse = impulsei;
1281 1281
1282 if (localGlobalTF) 1282 if (localGlobalTF)
1283 { 1283 {
@@ -1285,7 +1285,7 @@ if (m_shape != null) {
1285 Quaternion AXgrot = grot; 1285 Quaternion AXgrot = grot;
1286 Vector3 AXimpulsei = impulsei; 1286 Vector3 AXimpulsei = impulsei;
1287 Vector3 newimpulse = AXimpulsei * AXgrot; 1287 Vector3 newimpulse = AXimpulsei * AXgrot;
1288 impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z); 1288 impulse = newimpulse;
1289 } 1289 }
1290 1290
1291 if (m_parentGroup != null) 1291 if (m_parentGroup != null)
@@ -1333,8 +1333,8 @@ if (m_shape != null) {
1333 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( 1333 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
1334 Name, 1334 Name,
1335 Shape, 1335 Shape,
1336 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z), 1336 AbsolutePosition,
1337 new PhysicsVector(Scale.X, Scale.Y, Scale.Z), 1337 Scale,
1338 RotationOffset, 1338 RotationOffset,
1339 RigidBody); 1339 RigidBody);
1340 1340
@@ -1523,7 +1523,7 @@ if (m_shape != null) {
1523 PhysicsJoint joint; 1523 PhysicsJoint joint;
1524 1524
1525 joint = m_parentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType, 1525 joint = m_parentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType,
1526 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z), 1526 AbsolutePosition,
1527 this.RotationOffset, 1527 this.RotationOffset,
1528 Description, 1528 Description,
1529 bodyNames, 1529 bodyNames,
@@ -1708,12 +1708,12 @@ if (m_shape != null) {
1708 } 1708 }
1709 } 1709 }
1710 1710
1711 public PhysicsVector GetForce() 1711 public Vector3 GetForce()
1712 { 1712 {
1713 if (PhysActor != null) 1713 if (PhysActor != null)
1714 return PhysActor.Force; 1714 return PhysActor.Force;
1715 else 1715 else
1716 return new PhysicsVector(); 1716 return Vector3.Zero;
1717 } 1717 }
1718 1718
1719 public void GetProperties(IClientAPI client) 1719 public void GetProperties(IClientAPI client)
@@ -2078,7 +2078,7 @@ if (m_shape != null) {
2078 } 2078 }
2079 } 2079 }
2080 2080
2081 public void PhysicsOutOfBounds(PhysicsVector pos) 2081 public void PhysicsOutOfBounds(Vector3 pos)
2082 { 2082 {
2083 m_log.Error("[PHYSICS]: Physical Object went out of bounds."); 2083 m_log.Error("[PHYSICS]: Physical Object went out of bounds.");
2084 2084
@@ -2564,7 +2564,7 @@ if (m_shape != null) {
2564 } 2564 }
2565 } 2565 }
2566 2566
2567 public void SetForce(PhysicsVector force) 2567 public void SetForce(Vector3 force)
2568 { 2568 {
2569 if (PhysActor != null) 2569 if (PhysActor != null)
2570 { 2570 {
@@ -2588,7 +2588,7 @@ if (m_shape != null) {
2588 } 2588 }
2589 } 2589 }
2590 2590
2591 public void SetVehicleVectorParam(int param, PhysicsVector value) 2591 public void SetVehicleVectorParam(int param, Vector3 value)
2592 { 2592 {
2593 if (PhysActor != null) 2593 if (PhysActor != null)
2594 { 2594 {
@@ -3430,8 +3430,8 @@ if (m_shape != null) {
3430 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( 3430 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
3431 Name, 3431 Name,
3432 Shape, 3432 Shape,
3433 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z), 3433 AbsolutePosition,
3434 new PhysicsVector(Scale.X, Scale.Y, Scale.Z), 3434 Scale,
3435 RotationOffset, 3435 RotationOffset,
3436 UsePhysics); 3436 UsePhysics);
3437 3437
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0ac5be0..87fac0c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -434,7 +434,7 @@ namespace OpenSim.Region.Framework.Scenes
434 { 434 {
435 lock (m_scene.SyncRoot) 435 lock (m_scene.SyncRoot)
436 { 436 {
437 m_physicsActor.Position = new PhysicsVector(value.X, value.Y, value.Z); 437 m_physicsActor.Position = value;
438 } 438 }
439 } 439 }
440 catch (Exception e) 440 catch (Exception e)
@@ -474,7 +474,7 @@ namespace OpenSim.Region.Framework.Scenes
474 { 474 {
475 lock (m_scene.SyncRoot) 475 lock (m_scene.SyncRoot)
476 { 476 {
477 m_physicsActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); 477 m_physicsActor.Velocity = value;
478 } 478 }
479 } 479 }
480 catch (Exception e) 480 catch (Exception e)
@@ -1046,7 +1046,7 @@ namespace OpenSim.Region.Framework.Scenes
1046 m_avHeight = height; 1046 m_avHeight = height;
1047 if (PhysicsActor != null && !IsChildAgent) 1047 if (PhysicsActor != null && !IsChildAgent)
1048 { 1048 {
1049 PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight); 1049 Vector3 SetSize = new Vector3(0.45f, 0.6f, m_avHeight);
1050 PhysicsActor.Size = SetSize; 1050 PhysicsActor.Size = SetSize;
1051 } 1051 }
1052 } 1052 }
@@ -3345,20 +3345,18 @@ namespace OpenSim.Region.Framework.Scenes
3345 3345
3346 PhysicsScene scene = m_scene.PhysicsScene; 3346 PhysicsScene scene = m_scene.PhysicsScene;
3347 3347
3348 PhysicsVector pVec = 3348 Vector3 pVec = AbsolutePosition;
3349 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
3350 AbsolutePosition.Z);
3351 3349
3352 // Old bug where the height was in centimeters instead of meters 3350 // Old bug where the height was in centimeters instead of meters
3353 if (m_avHeight == 127.0f) 3351 if (m_avHeight == 127.0f)
3354 { 3352 {
3355 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), 3353 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new Vector3(0f, 0f, 1.56f),
3356 isFlying); 3354 isFlying);
3357 } 3355 }
3358 else 3356 else
3359 { 3357 {
3360 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, 3358 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
3361 new PhysicsVector(0, 0, m_avHeight), isFlying); 3359 new Vector3(0f, 0f, m_avHeight), isFlying);
3362 } 3360 }
3363 scene.AddPhysicsActorTaint(m_physicsActor); 3361 scene.AddPhysicsActorTaint(m_physicsActor);
3364 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 3362 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
@@ -3369,7 +3367,7 @@ namespace OpenSim.Region.Framework.Scenes
3369 3367
3370 } 3368 }
3371 3369
3372 private void OutOfBoundsCall(PhysicsVector pos) 3370 private void OutOfBoundsCall(Vector3 pos)
3373 { 3371 {
3374 //bool flying = m_physicsActor.Flying; 3372 //bool flying = m_physicsActor.Flying;
3375 //RemoveFromPhysicalScene(); 3373 //RemoveFromPhysicalScene();
@@ -3592,7 +3590,7 @@ namespace OpenSim.Region.Framework.Scenes
3592 */ 3590 */
3593 } 3591 }
3594 3592
3595 internal void PushForce(PhysicsVector impulse) 3593 internal void PushForce(Vector3 impulse)
3596 { 3594 {
3597 if (PhysicsActor != null) 3595 if (PhysicsActor != null)
3598 { 3596 {
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index 292e345..1f1ebae 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -525,8 +525,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
525 { 525 {
526 get 526 get
527 { 527 {
528 PhysicsVector tmp = GetSOP().PhysActor.GeometricCenter; 528 Vector3 tmp = GetSOP().PhysActor.GeometricCenter;
529 return new Vector3(tmp.X, tmp.Y, tmp.Z); 529 return tmp;
530 } 530 }
531 } 531 }
532 532
@@ -534,8 +534,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
534 { 534 {
535 get 535 get
536 { 536 {
537 PhysicsVector tmp = GetSOP().PhysActor.CenterOfMass; 537 Vector3 tmp = GetSOP().PhysActor.CenterOfMass;
538 return new Vector3(tmp.X, tmp.Y, tmp.Z); 538 return tmp;
539 } 539 }
540 } 540 }
541 541
@@ -543,15 +543,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
543 { 543 {
544 get 544 get
545 { 545 {
546 PhysicsVector tmp = GetSOP().PhysActor.RotationalVelocity; 546 Vector3 tmp = GetSOP().PhysActor.RotationalVelocity;
547 return new Vector3(tmp.X, tmp.Y, tmp.Z); 547 return tmp;
548 } 548 }
549 set 549 set
550 { 550 {
551 if (!CanEdit()) 551 if (!CanEdit())
552 return; 552 return;
553 553
554 GetSOP().PhysActor.RotationalVelocity = new PhysicsVector(value.X, value.Y, value.Z); 554 GetSOP().PhysActor.RotationalVelocity = value;
555 } 555 }
556 } 556 }
557 557
@@ -559,15 +559,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
559 { 559 {
560 get 560 get
561 { 561 {
562 PhysicsVector tmp = GetSOP().PhysActor.Velocity; 562 Vector3 tmp = GetSOP().PhysActor.Velocity;
563 return new Vector3(tmp.X, tmp.Y, tmp.Z); 563 return tmp;
564 } 564 }
565 set 565 set
566 { 566 {
567 if (!CanEdit()) 567 if (!CanEdit())
568 return; 568 return;
569 569
570 GetSOP().PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); 570 GetSOP().PhysActor.Velocity = value;
571 } 571 }
572 } 572 }
573 573
@@ -575,15 +575,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
575 { 575 {
576 get 576 get
577 { 577 {
578 PhysicsVector tmp = GetSOP().PhysActor.Torque; 578 Vector3 tmp = GetSOP().PhysActor.Torque;
579 return new Vector3(tmp.X, tmp.Y, tmp.Z); 579 return tmp;
580 } 580 }
581 set 581 set
582 { 582 {
583 if (!CanEdit()) 583 if (!CanEdit())
584 return; 584 return;
585 585
586 GetSOP().PhysActor.Torque = new PhysicsVector(value.X, value.Y, value.Z); 586 GetSOP().PhysActor.Torque = value;
587 } 587 }
588 } 588 }
589 589
@@ -591,8 +591,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
591 { 591 {
592 get 592 get
593 { 593 {
594 PhysicsVector tmp = GetSOP().PhysActor.Acceleration; 594 Vector3 tmp = GetSOP().PhysActor.Acceleration;
595 return new Vector3(tmp.X, tmp.Y, tmp.Z); 595 return tmp;
596 } 596 }
597 } 597 }
598 598
@@ -600,15 +600,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
600 { 600 {
601 get 601 get
602 { 602 {
603 PhysicsVector tmp = GetSOP().PhysActor.Force; 603 Vector3 tmp = GetSOP().PhysActor.Force;
604 return new Vector3(tmp.X, tmp.Y, tmp.Z); 604 return tmp;
605 } 605 }
606 set 606 set
607 { 607 {
608 if (!CanEdit()) 608 if (!CanEdit())
609 return; 609 return;
610 610
611 GetSOP().PhysActor.Force = new PhysicsVector(value.X, value.Y, value.Z); 611 GetSOP().PhysActor.Force = value;
612 } 612 }
613 } 613 }
614 614
@@ -627,7 +627,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
627 if (!CanEdit()) 627 if (!CanEdit())
628 return; 628 return;
629 629
630 GetSOP().PhysActor.AddForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); 630 GetSOP().PhysActor.AddForce(force, pushforce);
631 } 631 }
632 632
633 public void AddAngularForce(Vector3 force, bool pushforce) 633 public void AddAngularForce(Vector3 force, bool pushforce)
@@ -635,7 +635,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
635 if (!CanEdit()) 635 if (!CanEdit())
636 return; 636 return;
637 637
638 GetSOP().PhysActor.AddAngularForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); 638 GetSOP().PhysActor.AddAngularForce(force, pushforce);
639 } 639 }
640 640
641 public void SetMomentum(Vector3 momentum) 641 public void SetMomentum(Vector3 momentum)
@@ -643,7 +643,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
643 if (!CanEdit()) 643 if (!CanEdit())
644 return; 644 return;
645 645
646 GetSOP().PhysActor.SetMomentum(new PhysicsVector(momentum.X, momentum.Y, momentum.Z)); 646 GetSOP().PhysActor.SetMomentum(momentum);
647 } 647 }
648 648
649 #endregion 649 #endregion
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
index 8d8b3fe..8df997e 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
@@ -36,20 +36,16 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
36{ 36{
37 public class BasicActor : PhysicsActor 37 public class BasicActor : PhysicsActor
38 { 38 {
39 private PhysicsVector _position; 39 private Vector3 _position;
40 private PhysicsVector _velocity; 40 private Vector3 _velocity;
41 private PhysicsVector _acceleration; 41 private Vector3 _acceleration;
42 private PhysicsVector _size; 42 private Vector3 _size;
43 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 43 private Vector3 m_rotationalVelocity;
44 private bool flying; 44 private bool flying;
45 private bool iscolliding; 45 private bool iscolliding;
46 46
47 public BasicActor() 47 public BasicActor()
48 { 48 {
49 _velocity = new PhysicsVector();
50 _position = new PhysicsVector();
51 _acceleration = new PhysicsVector();
52 _size = new PhysicsVector();
53 } 49 }
54 50
55 public override int PhysicsActorType 51 public override int PhysicsActorType
@@ -58,7 +54,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
58 set { return; } 54 set { return; }
59 } 55 }
60 56
61 public override PhysicsVector RotationalVelocity 57 public override Vector3 RotationalVelocity
62 { 58 {
63 get { return m_rotationalVelocity; } 59 get { return m_rotationalVelocity; }
64 set { m_rotationalVelocity = value; } 60 set { m_rotationalVelocity = value; }
@@ -137,13 +133,13 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
137 get { return false; } 133 get { return false; }
138 } 134 }
139 135
140 public override PhysicsVector Position 136 public override Vector3 Position
141 { 137 {
142 get { return _position; } 138 get { return _position; }
143 set { _position = value; } 139 set { _position = value; }
144 } 140 }
145 141
146 public override PhysicsVector Size 142 public override Vector3 Size
147 { 143 {
148 get { return _size; } 144 get { return _size; }
149 set { 145 set {
@@ -162,9 +158,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
162 get { return 0f; } 158 get { return 0f; }
163 } 159 }
164 160
165 public override PhysicsVector Force 161 public override Vector3 Force
166 { 162 {
167 get { return PhysicsVector.Zero; } 163 get { return Vector3.Zero; }
168 set { return; } 164 set { return; }
169 } 165 }
170 166
@@ -179,7 +175,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
179 175
180 } 176 }
181 177
182 public override void VehicleVectorParam(int param, PhysicsVector value) 178 public override void VehicleVectorParam(int param, Vector3 value)
183 { 179 {
184 180
185 } 181 }
@@ -194,25 +190,25 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
194 190
195 } 191 }
196 192
197 public override PhysicsVector CenterOfMass 193 public override Vector3 CenterOfMass
198 { 194 {
199 get { return PhysicsVector.Zero; } 195 get { return Vector3.Zero; }
200 } 196 }
201 197
202 public override PhysicsVector GeometricCenter 198 public override Vector3 GeometricCenter
203 { 199 {
204 get { return PhysicsVector.Zero; } 200 get { return Vector3.Zero; }
205 } 201 }
206 202
207 public override PhysicsVector Velocity 203 public override Vector3 Velocity
208 { 204 {
209 get { return _velocity; } 205 get { return _velocity; }
210 set { _velocity = value; } 206 set { _velocity = value; }
211 } 207 }
212 208
213 public override PhysicsVector Torque 209 public override Vector3 Torque
214 { 210 {
215 get { return PhysicsVector.Zero; } 211 get { return Vector3.Zero; }
216 set { return; } 212 set { return; }
217 } 213 }
218 214
@@ -228,7 +224,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
228 set { } 224 set { }
229 } 225 }
230 226
231 public override PhysicsVector Acceleration 227 public override Vector3 Acceleration
232 { 228 {
233 get { return _acceleration; } 229 get { return _acceleration; }
234 } 230 }
@@ -247,24 +243,24 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
247 { 243 {
248 } 244 }
249 245
250 public override void LockAngularMotion(PhysicsVector axis) 246 public override void LockAngularMotion(Vector3 axis)
251 { 247 {
252 } 248 }
253 249
254 public void SetAcceleration(PhysicsVector accel) 250 public void SetAcceleration(Vector3 accel)
255 { 251 {
256 _acceleration = accel; 252 _acceleration = accel;
257 } 253 }
258 254
259 public override void AddForce(PhysicsVector force, bool pushforce) 255 public override void AddForce(Vector3 force, bool pushforce)
260 { 256 {
261 } 257 }
262 258
263 public override void AddAngularForce(PhysicsVector force, bool pushforce) 259 public override void AddAngularForce(Vector3 force, bool pushforce)
264 { 260 {
265 } 261 }
266 262
267 public override void SetMomentum(PhysicsVector momentum) 263 public override void SetMomentum(Vector3 momentum)
268 { 264 {
269 } 265 }
270 266
@@ -272,7 +268,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
272 { 268 {
273 } 269 }
274 270
275 public override PhysicsVector PIDTarget 271 public override Vector3 PIDTarget
276 { 272 {
277 set { return; } 273 set { return; }
278 } 274 }
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
index 66bd099..b6e1cb4 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
54 { 54 {
55 55
56 } 56 }
57 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) 57 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
58 { 58 {
59 BasicActor act = new BasicActor(); 59 BasicActor act = new BasicActor();
60 act.Position = position; 60 act.Position = position;
@@ -77,20 +77,20 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
77 } 77 }
78 78
79/* 79/*
80 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) 80 public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
81 { 81 {
82 return null; 82 return null;
83 } 83 }
84*/ 84*/
85 85
86 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 86 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
87 PhysicsVector size, Quaternion rotation) 87 Vector3 size, Quaternion rotation)
88 { 88 {
89 return AddPrimShape(primName, pbs, position, size, rotation, false); 89 return AddPrimShape(primName, pbs, position, size, rotation, false);
90 } 90 }
91 91
92 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 92 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
93 PhysicsVector size, Quaternion rotation, bool isPhysical) 93 Vector3 size, Quaternion rotation, bool isPhysical)
94 { 94 {
95 return null; 95 return null;
96 } 96 }
@@ -105,26 +105,28 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
105 for (int i = 0; i < _actors.Count; ++i) 105 for (int i = 0; i < _actors.Count; ++i)
106 { 106 {
107 BasicActor actor = _actors[i]; 107 BasicActor actor = _actors[i];
108 Vector3 actorPosition = actor.Position;
109 Vector3 actorVelocity = actor.Velocity;
108 110
109 actor.Position.X += actor.Velocity.X*timeStep; 111 actorPosition.X += actor.Velocity.X*timeStep;
110 actor.Position.Y += actor.Velocity.Y*timeStep; 112 actorPosition.Y += actor.Velocity.Y*timeStep;
111 113
112 if (actor.Position.Y < 0) 114 if (actor.Position.Y < 0)
113 { 115 {
114 actor.Position.Y = 0.1F; 116 actorPosition.Y = 0.1F;
115 } 117 }
116 else if (actor.Position.Y >= Constants.RegionSize) 118 else if (actor.Position.Y >= Constants.RegionSize)
117 { 119 {
118 actor.Position.Y = ((int)Constants.RegionSize - 0.1f); 120 actorPosition.Y = ((int)Constants.RegionSize - 0.1f);
119 } 121 }
120 122
121 if (actor.Position.X < 0) 123 if (actor.Position.X < 0)
122 { 124 {
123 actor.Position.X = 0.1F; 125 actorPosition.X = 0.1F;
124 } 126 }
125 else if (actor.Position.X >= Constants.RegionSize) 127 else if (actor.Position.X >= Constants.RegionSize)
126 { 128 {
127 actor.Position.X = ((int)Constants.RegionSize - 0.1f); 129 actorPosition.X = ((int)Constants.RegionSize - 0.1f);
128 } 130 }
129 131
130 float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z; 132 float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z;
@@ -133,23 +135,27 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
133 if (actor.Position.Z + (actor.Velocity.Z*timeStep) < 135 if (actor.Position.Z + (actor.Velocity.Z*timeStep) <
134 _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2) 136 _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2)
135 { 137 {
136 actor.Position.Z = height; 138 actorPosition.Z = height;
137 actor.Velocity.Z = 0; 139 actorVelocity.Z = 0;
138 actor.IsColliding = true; 140 actor.IsColliding = true;
139 } 141 }
140 else 142 else
141 { 143 {
142 actor.Position.Z += actor.Velocity.Z*timeStep; 144 actorPosition.Z += actor.Velocity.Z*timeStep;
143 actor.IsColliding = false; 145 actor.IsColliding = false;
144 } 146 }
145 } 147 }
146 else 148 else
147 { 149 {
148 actor.Position.Z = height; 150 actorPosition.Z = height;
149 actor.Velocity.Z = 0; 151 actorVelocity.Z = 0;
150 actor.IsColliding = true; 152 actor.IsColliding = true;
151 } 153 }
154
155 actor.Position = actorPosition;
156 actor.Velocity = actorVelocity;
152 } 157 }
158
153 return fps; 159 return fps;
154 } 160 }
155 161
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
index 8da9687..5ed3b14 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
@@ -60,15 +60,15 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
60 private btQuaternion m_bodyOrientation; 60 private btQuaternion m_bodyOrientation;
61 private btDefaultMotionState m_bodyMotionState; 61 private btDefaultMotionState m_bodyMotionState;
62 private btGeneric6DofConstraint m_aMotor; 62 private btGeneric6DofConstraint m_aMotor;
63 // private PhysicsVector m_movementComparision; 63 // private Vector3 m_movementComparision;
64 private PhysicsVector m_position; 64 private Vector3 m_position;
65 private PhysicsVector m_zeroPosition; 65 private Vector3 m_zeroPosition;
66 private bool m_zeroFlag = false; 66 private bool m_zeroFlag = false;
67 private bool m_lastUpdateSent = false; 67 private bool m_lastUpdateSent = false;
68 private PhysicsVector m_velocity; 68 private Vector3 m_velocity;
69 private PhysicsVector m_target_velocity; 69 private Vector3 m_target_velocity;
70 private PhysicsVector m_acceleration; 70 private Vector3 m_acceleration;
71 private PhysicsVector m_rotationalVelocity; 71 private Vector3 m_rotationalVelocity;
72 private bool m_pidControllerActive = true; 72 private bool m_pidControllerActive = true;
73 public float PID_D = 80.0f; 73 public float PID_D = 80.0f;
74 public float PID_P = 90.0f; 74 public float PID_P = 90.0f;
@@ -96,8 +96,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
96 private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. 96 private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes.
97 private bool m_taintRemove = false; 97 private bool m_taintRemove = false;
98 // private bool m_taintedPosition = false; 98 // private bool m_taintedPosition = false;
99 // private PhysicsVector m_taintedPosition_value; 99 // private Vector3 m_taintedPosition_value;
100 private PhysicsVector m_taintedForce; 100 private Vector3 m_taintedForce;
101 101
102 private float m_buoyancy = 0f; 102 private float m_buoyancy = 0f;
103 103
@@ -115,14 +115,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
115 public int m_eventsubscription = 0; 115 public int m_eventsubscription = 0;
116 // private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); 116 // private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
117 117
118 public BulletDotNETCharacter(string avName, BulletDotNETScene parent_scene, PhysicsVector pos, PhysicsVector size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) 118 public BulletDotNETCharacter(string avName, BulletDotNETScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
119 { 119 {
120 m_taintedForce = new PhysicsVector();
121 m_velocity = new PhysicsVector();
122 m_target_velocity = new PhysicsVector();
123 m_position = pos; 120 m_position = pos;
124 m_zeroPosition = new PhysicsVector(pos.X, pos.Y, pos.Z); // this is a class, not a struct. Must make new, or m_zeroPosition will == position regardless 121 m_zeroPosition = pos;
125 m_acceleration = new PhysicsVector();
126 m_parent_scene = parent_scene; 122 m_parent_scene = parent_scene;
127 PID_D = pid_d; 123 PID_D = pid_d;
128 PID_P = pid_p; 124 PID_P = pid_p;
@@ -161,9 +157,6 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
161 tempTrans1 = new btTransform(tempQuat1, tempVector1); 157 tempTrans1 = new btTransform(tempQuat1, tempVector1);
162 // m_movementComparision = new PhysicsVector(0, 0, 0); 158 // m_movementComparision = new PhysicsVector(0, 0, 0);
163 m_CapsuleOrientationAxis = new btVector3(1, 0, 1); 159 m_CapsuleOrientationAxis = new btVector3(1, 0, 1);
164
165
166
167 } 160 }
168 161
169 /// <summary> 162 /// <summary>
@@ -254,18 +247,18 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
254 get { return m_zeroFlag; } 247 get { return m_zeroFlag; }
255 } 248 }
256 249
257 public override PhysicsVector Size 250 public override Vector3 Size
258 { 251 {
259 get { return new PhysicsVector(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); } 252 get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
260 set 253 set
261 { 254 {
262 m_pidControllerActive = true; 255 m_pidControllerActive = true;
263 256
264 PhysicsVector SetSize = value; 257 Vector3 SetSize = value;
265 m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; 258 m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
266 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); 259 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
267 260
268 Velocity = new PhysicsVector(0f, 0f, 0f); 261 Velocity = Vector3.Zero;
269 262
270 m_parent_scene.AddPhysicsActorTaint(this); 263 m_parent_scene.AddPhysicsActorTaint(this);
271 } 264 }
@@ -317,12 +310,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
317 310
318 } 311 }
319 312
320 public override void LockAngularMotion(PhysicsVector axis) 313 public override void LockAngularMotion(Vector3 axis)
321 { 314 {
322 315
323 } 316 }
324 317
325 public override PhysicsVector Position 318 public override Vector3 Position
326 { 319 {
327 get { return m_position; } 320 get { return m_position; }
328 set 321 set
@@ -342,9 +335,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
342 } 335 }
343 } 336 }
344 337
345 public override PhysicsVector Force 338 public override Vector3 Force
346 { 339 {
347 get { return new PhysicsVector(m_target_velocity.X, m_target_velocity.Y, m_target_velocity.Z); } 340 get { return m_target_velocity; }
348 set { return; } 341 set { return; }
349 } 342 }
350 343
@@ -359,7 +352,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
359 352
360 } 353 }
361 354
362 public override void VehicleVectorParam(int param, PhysicsVector value) 355 public override void VehicleVectorParam(int param, Vector3 value)
363 { 356 {
364 357
365 } 358 }
@@ -374,23 +367,22 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
374 367
375 } 368 }
376 369
377 public override PhysicsVector GeometricCenter 370 public override Vector3 GeometricCenter
378 { 371 {
379 get { return PhysicsVector.Zero; } 372 get { return Vector3.Zero; }
380 } 373 }
381 374
382 public override PhysicsVector CenterOfMass 375 public override Vector3 CenterOfMass
383 { 376 {
384 get { return PhysicsVector.Zero; } 377 get { return Vector3.Zero; }
385 } 378 }
386 379
387 public override PhysicsVector Velocity 380 public override Vector3 Velocity
388 { 381 {
389 get 382 get
390 { 383 {
391 // There's a problem with PhysicsVector.Zero! Don't Use it Here!
392 if (m_zeroFlag) 384 if (m_zeroFlag)
393 return new PhysicsVector(0f, 0f, 0f); 385 return Vector3.Zero;
394 m_lastUpdateSent = false; 386 m_lastUpdateSent = false;
395 return m_velocity; 387 return m_velocity;
396 } 388 }
@@ -401,9 +393,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
401 } 393 }
402 } 394 }
403 395
404 public override PhysicsVector Torque 396 public override Vector3 Torque
405 { 397 {
406 get { return PhysicsVector.Zero; } 398 get { return Vector3.Zero; }
407 set { return; } 399 set { return; }
408 } 400 }
409 401
@@ -413,7 +405,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
413 set { } 405 set { }
414 } 406 }
415 407
416 public override PhysicsVector Acceleration 408 public override Vector3 Acceleration
417 { 409 {
418 get { return m_acceleration; } 410 get { return m_acceleration; }
419 } 411 }
@@ -586,7 +578,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
586 set { return; } 578 set { return; }
587 } 579 }
588 580
589 public override PhysicsVector RotationalVelocity 581 public override Vector3 RotationalVelocity
590 { 582 {
591 get { return m_rotationalVelocity; } 583 get { return m_rotationalVelocity; }
592 set { m_rotationalVelocity = value; } 584 set { m_rotationalVelocity = value; }
@@ -604,7 +596,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
604 set { m_buoyancy = value; } 596 set { m_buoyancy = value; }
605 } 597 }
606 598
607 public override PhysicsVector PIDTarget { set { return; } } 599 public override Vector3 PIDTarget { set { return; } }
608 public override bool PIDActive { set { return; } } 600 public override bool PIDActive { set { return; } }
609 public override float PIDTau { set { return; } } 601 public override float PIDTau { set { return; } }
610 602
@@ -634,7 +626,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
634 /// </summary> 626 /// </summary>
635 /// <param name="force"></param> 627 /// <param name="force"></param>
636 /// <param name="pushforce">Is this a push by a script?</param> 628 /// <param name="pushforce">Is this a push by a script?</param>
637 public override void AddForce(PhysicsVector force, bool pushforce) 629 public override void AddForce(Vector3 force, bool pushforce)
638 { 630 {
639 if (pushforce) 631 if (pushforce)
640 { 632 {
@@ -656,7 +648,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
656 //m_lastUpdateSent = false; 648 //m_lastUpdateSent = false;
657 } 649 }
658 650
659 public void doForce(PhysicsVector force, bool now) 651 public void doForce(Vector3 force, bool now)
660 { 652 {
661 653
662 tempVector3.setValue(force.X, force.Y, force.Z); 654 tempVector3.setValue(force.X, force.Y, force.Z);
@@ -671,7 +663,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
671 } 663 }
672 } 664 }
673 665
674 public void doImpulse(PhysicsVector force, bool now) 666 public void doImpulse(Vector3 force, bool now)
675 { 667 {
676 668
677 tempVector3.setValue(force.X, force.Y, force.Z); 669 tempVector3.setValue(force.X, force.Y, force.Z);
@@ -686,12 +678,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
686 } 678 }
687 } 679 }
688 680
689 public override void AddAngularForce(PhysicsVector force, bool pushforce) 681 public override void AddAngularForce(Vector3 force, bool pushforce)
690 { 682 {
691 683
692 } 684 }
693 685
694 public override void SetMomentum(PhysicsVector momentum) 686 public override void SetMomentum(Vector3 momentum)
695 { 687 {
696 688
697 } 689 }
@@ -808,7 +800,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
808 800
809 AvatarGeomAndBodyCreation(m_position.X, m_position.Y, 801 AvatarGeomAndBodyCreation(m_position.X, m_position.Y,
810 m_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2)); 802 m_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2));
811 Velocity = new PhysicsVector(0f, 0f, 0f); 803 Velocity = Vector3.Zero;
812 804
813 } 805 }
814 else 806 else
@@ -852,9 +844,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
852 } 844 }
853 //PidStatus = true; 845 //PidStatus = true;
854 846
855 PhysicsVector vec = new PhysicsVector(); 847 Vector3 vec = Vector3.Zero;
856 848
857 PhysicsVector vel = new PhysicsVector(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ()); 849 Vector3 vel = new Vector3(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ());
858 850
859 float movementdivisor = 1f; 851 float movementdivisor = 1f;
860 852
@@ -885,7 +877,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
885 // Avatar to Avatar collisions 877 // Avatar to Avatar collisions
886 // Prim to avatar collisions 878 // Prim to avatar collisions
887 879
888 PhysicsVector pos = new PhysicsVector(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ()); 880 Vector3 pos = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
889 vec.X = (m_target_velocity.X - vel.X) * (PID_D) + (m_zeroPosition.X - pos.X) * (PID_P * 2); 881 vec.X = (m_target_velocity.X - vel.X) * (PID_D) + (m_zeroPosition.X - pos.X) * (PID_P * 2);
890 vec.Y = (m_target_velocity.Y - vel.Y) * (PID_D) + (m_zeroPosition.Y - pos.Y) * (PID_P * 2); 882 vec.Y = (m_target_velocity.Y - vel.Y) * (PID_D) + (m_zeroPosition.Y - pos.Y) * (PID_P * 2);
891 if (m_flying) 883 if (m_flying)
@@ -927,7 +919,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
927 { 919 {
928 // We're colliding with something and we're not flying but we're moving 920 // We're colliding with something and we're not flying but we're moving
929 // This means we're walking or running. 921 // This means we're walking or running.
930 PhysicsVector pos = new PhysicsVector(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ()); 922 Vector3 pos = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
931 vec.Z = (m_target_velocity.Z - vel.Z) * PID_D + (m_zeroPosition.Z - pos.Z) * PID_P; 923 vec.Z = (m_target_velocity.Z - vel.Z) * PID_D + (m_zeroPosition.Z - pos.Z) * PID_P;
932 if (m_target_velocity.X > 0) 924 if (m_target_velocity.X > 0)
933 { 925 {
@@ -1016,7 +1008,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1016 tempVector2 = Body.getInterpolationLinearVelocity(); 1008 tempVector2 = Body.getInterpolationLinearVelocity();
1017 1009
1018 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! 1010 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
1019 PhysicsVector vec = new PhysicsVector(tempVector1.getX(),tempVector1.getY(),tempVector1.getZ()); 1011 Vector3 vec = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
1020 1012
1021 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) 1013 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
1022 if (vec.X < -10.0f) vec.X = 0.0f; 1014 if (vec.X < -10.0f) vec.X = 0.0f;
@@ -1048,7 +1040,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1048 else 1040 else
1049 { 1041 {
1050 m_lastUpdateSent = false; 1042 m_lastUpdateSent = false;
1051 vec = new PhysicsVector(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ()); 1043 vec = new Vector3(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ());
1052 m_velocity.X = (vec.X); 1044 m_velocity.X = (vec.X);
1053 m_velocity.Y = (vec.Y); 1045 m_velocity.Y = (vec.Y);
1054 1046
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
index f22ea71..5b542db 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
@@ -43,44 +43,43 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 private PhysicsVector _position; 46 private Vector3 _position;
47 private PhysicsVector m_zeroPosition; 47 private Vector3 m_zeroPosition;
48 private PhysicsVector _velocity; 48 private Vector3 _velocity;
49 private PhysicsVector _torque = new PhysicsVector(0, 0, 0); 49 private Vector3 _torque;
50 private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); 50 private Vector3 m_lastVelocity;
51 private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); 51 private Vector3 m_lastposition;
52 private Quaternion m_lastorientation = new Quaternion(); 52 private Quaternion m_lastorientation = Quaternion.Identity;
53 private PhysicsVector m_rotationalVelocity; 53 private Vector3 m_rotationalVelocity;
54 private PhysicsVector _size; 54 private Vector3 _size;
55 private PhysicsVector _acceleration; 55 private Vector3 _acceleration;
56 // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); 56 // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f);
57 private Quaternion _orientation; 57 private Quaternion _orientation;
58 private PhysicsVector m_taintposition; 58 private Vector3 m_taintposition;
59 private PhysicsVector m_taintsize; 59 private Vector3 m_taintsize;
60 private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0); 60 private Vector3 m_taintVelocity;
61 private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0); 61 private Vector3 m_taintTorque;
62 private Quaternion m_taintrot; 62 private Quaternion m_taintrot;
63 private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f); 63 private Vector3 m_angularlock = Vector3.One;
64 private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f); 64 private Vector3 m_taintAngularLock = Vector3.One;
65 // private btGeneric6DofConstraint Amotor; 65 // private btGeneric6DofConstraint Amotor;
66 66
67 private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0); 67 private Vector3 m_PIDTarget;
68 private float m_PIDTau = 0f; 68 private float m_PIDTau;
69 private float m_PIDHoverHeight = 0f; 69 private float m_PIDHoverHeight;
70 private float m_PIDHoverTau = 0f; 70 private float m_PIDHoverTau;
71 private bool m_useHoverPID = false; 71 private bool m_useHoverPID;
72 private PIDHoverType m_PIDHoverType = PIDHoverType.Ground; 72 private PIDHoverType m_PIDHoverType = PIDHoverType.Ground;
73 private float m_targetHoverHeight = 0f; 73 private float m_targetHoverHeight;
74 private float m_groundHeight = 0f; 74 private float m_groundHeight;
75 private float m_waterHeight = 0f; 75 private float m_waterHeight;
76 private float PID_D = 35f; 76 private float PID_D = 35f;
77 private float PID_G = 25f; 77 private float PID_G = 25f;
78 // private float m_tensor = 5f; 78 // private float m_tensor = 5f;
79 // private int body_autodisable_frames = 20; 79 // private int body_autodisable_frames = 20;
80 private IMesh primMesh = null; 80 private IMesh primMesh;
81
82 private bool m_usePID = false;
83 81
82 private bool m_usePID;
84 83
85 private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom 84 private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom
86 | CollisionCategories.Space 85 | CollisionCategories.Space
@@ -88,11 +87,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
88 | CollisionCategories.Character 87 | CollisionCategories.Character
89 ); 88 );
90 89
91 private bool m_taintshape = false; 90 private bool m_taintshape;
92 private bool m_taintPhysics = false; 91 private bool m_taintPhysics;
93 // private bool m_collidesLand = true; 92 // private bool m_collidesLand = true;
94 private bool m_collidesWater = false; 93 private bool m_collidesWater;
95 public bool m_returnCollisions = false; 94 public bool m_returnCollisions;
96 95
97 // Default we're a Geometry 96 // Default we're a Geometry
98 // private CollisionCategories m_collisionCategories = (CollisionCategories.Geom); 97 // private CollisionCategories m_collisionCategories = (CollisionCategories.Geom);
@@ -100,23 +99,23 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
100 // Default, Collide with Other Geometries, spaces and Bodies 99 // Default, Collide with Other Geometries, spaces and Bodies
101 // private CollisionCategories m_collisionFlags = m_default_collisionFlags; 100 // private CollisionCategories m_collisionFlags = m_default_collisionFlags;
102 101
103 public bool m_taintremove = false; 102 public bool m_taintremove;
104 public bool m_taintdisable = false; 103 public bool m_taintdisable;
105 public bool m_disabled = false; 104 public bool m_disabled;
106 public bool m_taintadd = false; 105 public bool m_taintadd;
107 public bool m_taintselected = false; 106 public bool m_taintselected;
108 public bool m_taintCollidesWater = false; 107 public bool m_taintCollidesWater;
109 108
110 public uint m_localID = 0; 109 public uint m_localID;
111 110
112 //public GCHandle gc; 111 //public GCHandle gc;
113 // private CollisionLocker ode; 112 // private CollisionLocker ode;
114 113
115 private bool m_taintforce = false; 114 private bool m_taintforce;
116 private bool m_taintaddangularforce = false; 115 private bool m_taintaddangularforce;
117 private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f); 116 private Vector3 m_force;
118 private List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); 117 private List<Vector3> m_forcelist = new List<Vector3>();
119 private List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>(); 118 private List<Vector3> m_angularforcelist = new List<Vector3>();
120 119
121 private IMesh _mesh; 120 private IMesh _mesh;
122 private PrimitiveBaseShape _pbs; 121 private PrimitiveBaseShape _pbs;
@@ -124,40 +123,40 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
124 public btCollisionShape prim_geom; 123 public btCollisionShape prim_geom;
125 public IntPtr _triMeshData; 124 public IntPtr _triMeshData;
126 125
127 private PhysicsActor _parent = null; 126 private PhysicsActor _parent;
128 private PhysicsActor m_taintparent = null; 127 private PhysicsActor m_taintparent;
129 128
130 private List<BulletDotNETPrim> childrenPrim = new List<BulletDotNETPrim>(); 129 private List<BulletDotNETPrim> childrenPrim = new List<BulletDotNETPrim>();
131 130
132 private bool iscolliding = false; 131 private bool iscolliding;
133 private bool m_isphysical = false; 132 private bool m_isphysical;
134 private bool m_isSelected = false; 133 private bool m_isSelected;
135 134
136 internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively 135 internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively
137 136
138 private bool m_throttleUpdates = false; 137 private bool m_throttleUpdates;
139 // private int throttleCounter = 0; 138 // private int throttleCounter;
140 public int m_interpenetrationcount = 0; 139 public int m_interpenetrationcount;
141 public float m_collisionscore = 0; 140 public float m_collisionscore;
142 public int m_roundsUnderMotionThreshold = 0; 141 public int m_roundsUnderMotionThreshold;
143 private int m_crossingfailures = 0; 142 private int m_crossingfailures;
144 143
145 public float m_buoyancy = 0f; 144 public float m_buoyancy;
146 145
147 public bool outofBounds = false; 146 public bool outofBounds;
148 private float m_density = 10.000006836f; // Aluminum g/cm3; 147 private float m_density = 10.000006836f; // Aluminum g/cm3;
149 148
150 public bool _zeroFlag = false; 149 public bool _zeroFlag;
151 private bool m_lastUpdateSent = false; 150 private bool m_lastUpdateSent;
152 151
153 152
154 private String m_primName; 153 private String m_primName;
155 private PhysicsVector _target_velocity; 154 private Vector3 _target_velocity;
156 155
157 public int m_eventsubscription = 0; 156 public int m_eventsubscription;
158 // private CollisionEventUpdate CollisionEventsThisFrame = null; 157 // private CollisionEventUpdate CollisionEventsThisFrame = null;
159 158
160 public volatile bool childPrim = false; 159 public volatile bool childPrim;
161 160
162 private btVector3 tempPosition1; 161 private btVector3 tempPosition1;
163 private btVector3 tempPosition2; 162 private btVector3 tempPosition2;
@@ -190,7 +189,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
190 189
191 public btRigidBody Body; 190 public btRigidBody Body;
192 191
193 public BulletDotNETPrim(String primName, BulletDotNETScene parent_scene, PhysicsVector pos, PhysicsVector size, 192 public BulletDotNETPrim(String primName, BulletDotNETScene parent_scene, Vector3 pos, Vector3 size,
194 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical) 193 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical)
195 { 194 {
196 tempPosition1 = new btVector3(0, 0, 0); 195 tempPosition1 = new btVector3(0, 0, 0);
@@ -225,8 +224,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
225 224
226 AxisLockLinearHigh = new btVector3((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionSize); 225 AxisLockLinearHigh = new btVector3((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionSize);
227 226
228 _target_velocity = new PhysicsVector(0, 0, 0); 227 _target_velocity = Vector3.Zero;
229 _velocity = new PhysicsVector(); 228 _velocity = Vector3.Zero;
230 _position = pos; 229 _position = pos;
231 m_taintposition = pos; 230 m_taintposition = pos;
232 PID_D = parent_scene.bodyPIDD; 231 PID_D = parent_scene.bodyPIDD;
@@ -244,8 +243,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
244 243
245 _size = size; 244 _size = size;
246 m_taintsize = _size; 245 m_taintsize = _size;
247 _acceleration = new PhysicsVector(); 246 _acceleration = Vector3.Zero;
248 m_rotationalVelocity = PhysicsVector.Zero; 247 m_rotationalVelocity = Vector3.Zero;
249 _orientation = rotation; 248 _orientation = rotation;
250 m_taintrot = _orientation; 249 m_taintrot = _orientation;
251 _mesh = mesh; 250 _mesh = mesh;
@@ -274,7 +273,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
274 get { return _zeroFlag; } 273 get { return _zeroFlag; }
275 } 274 }
276 275
277 public override PhysicsVector Size 276 public override Vector3 Size
278 { 277 {
279 get { return _size; } 278 get { return _size; }
280 set { _size = value; } 279 set { _size = value; }
@@ -348,13 +347,13 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
348 m_taintparent = null; 347 m_taintparent = null;
349 } 348 }
350 349
351 public override void LockAngularMotion(PhysicsVector axis) 350 public override void LockAngularMotion(Vector3 axis)
352 { 351 {
353 m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z); 352 m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
354 m_taintAngularLock = new PhysicsVector(axis.X, axis.Y, axis.Z); 353 m_taintAngularLock = axis;
355 } 354 }
356 355
357 public override PhysicsVector Position 356 public override Vector3 Position
358 { 357 {
359 get { return _position; } 358 get { return _position; }
360 359
@@ -370,9 +369,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
370 get { return CalculateMass(); } 369 get { return CalculateMass(); }
371 } 370 }
372 371
373 public override PhysicsVector Force 372 public override Vector3 Force
374 { 373 {
375 //get { return PhysicsVector.Zero; } 374 //get { return Vector3.Zero; }
376 get { return m_force; } 375 get { return m_force; }
377 set { m_force = value; } 376 set { m_force = value; }
378 } 377 }
@@ -388,7 +387,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
388 //TODO: 387 //TODO:
389 } 388 }
390 389
391 public override void VehicleVectorParam(int param, PhysicsVector value) 390 public override void VehicleVectorParam(int param, Vector3 value)
392 { 391 {
393 //TODO: 392 //TODO:
394 } 393 }
@@ -405,23 +404,23 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
405 404
406 } 405 }
407 406
408 public override PhysicsVector GeometricCenter 407 public override Vector3 GeometricCenter
409 { 408 {
410 get { return PhysicsVector.Zero; } 409 get { return Vector3.Zero; }
411 } 410 }
412 411
413 public override PhysicsVector CenterOfMass 412 public override Vector3 CenterOfMass
414 { 413 {
415 get { return PhysicsVector.Zero; } 414 get { return Vector3.Zero; }
416 } 415 }
417 416
418 public override PhysicsVector Velocity 417 public override Vector3 Velocity
419 { 418 {
420 get 419 get
421 { 420 {
422 // Averate previous velocity with the new one so 421 // Averate previous velocity with the new one so
423 // client object interpolation works a 'little' better 422 // client object interpolation works a 'little' better
424 PhysicsVector returnVelocity = new PhysicsVector(); 423 Vector3 returnVelocity;
425 returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2; 424 returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2;
426 returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2; 425 returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2;
427 returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2; 426 returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2;
@@ -436,12 +435,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
436 } 435 }
437 } 436 }
438 437
439 public override PhysicsVector Torque 438 public override Vector3 Torque
440 { 439 {
441 get 440 get
442 { 441 {
443 if (!m_isphysical || Body.Handle == IntPtr.Zero) 442 if (!m_isphysical || Body.Handle == IntPtr.Zero)
444 return new PhysicsVector(0, 0, 0); 443 return Vector3.Zero;
445 444
446 return _torque; 445 return _torque;
447 } 446 }
@@ -459,7 +458,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
459 set { m_collisionscore = value; } 458 set { m_collisionscore = value; }
460 } 459 }
461 460
462 public override PhysicsVector Acceleration 461 public override Vector3 Acceleration
463 { 462 {
464 get { return _acceleration; } 463 get { return _acceleration; }
465 } 464 }
@@ -528,16 +527,16 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
528 } 527 }
529 } 528 }
530 529
531 public override PhysicsVector RotationalVelocity 530 public override Vector3 RotationalVelocity
532 { 531 {
533 get 532 get
534 { 533 {
535 PhysicsVector pv = new PhysicsVector(0, 0, 0); 534 Vector3 pv = Vector3.Zero;
536 if (_zeroFlag) 535 if (_zeroFlag)
537 return pv; 536 return pv;
538 m_lastUpdateSent = false; 537 m_lastUpdateSent = false;
539 538
540 if (m_rotationalVelocity.IsIdentical(pv, 0.2f)) 539 if (m_rotationalVelocity.ApproxEquals(pv, 0.2f))
541 return pv; 540 return pv;
542 541
543 return m_rotationalVelocity; 542 return m_rotationalVelocity;
@@ -557,7 +556,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
557 set { m_buoyancy = value; } 556 set { m_buoyancy = value; }
558 } 557 }
559 558
560 public override PhysicsVector PIDTarget { set { m_PIDTarget = value; ; } } 559 public override Vector3 PIDTarget { set { m_PIDTarget = value; ; } }
561 public override bool PIDActive { set { m_usePID = value; } } 560 public override bool PIDActive { set { m_usePID = value; } }
562 public override float PIDTau { set { m_PIDTau = value; } } 561 public override float PIDTau { set { m_PIDTau = value; } }
563 562
@@ -567,20 +566,20 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
567 public override float PIDHoverTau { set { m_PIDHoverTau = value; } } 566 public override float PIDHoverTau { set { m_PIDHoverTau = value; } }
568 567
569 568
570 public override void AddForce(PhysicsVector force, bool pushforce) 569 public override void AddForce(Vector3 force, bool pushforce)
571 { 570 {
572 m_forcelist.Add(force); 571 m_forcelist.Add(force);
573 m_taintforce = true; 572 m_taintforce = true;
574 //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); 573 //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString());
575 } 574 }
576 575
577 public override void AddAngularForce(PhysicsVector force, bool pushforce) 576 public override void AddAngularForce(Vector3 force, bool pushforce)
578 { 577 {
579 m_angularforcelist.Add(force); 578 m_angularforcelist.Add(force);
580 m_taintaddangularforce = true; 579 m_taintaddangularforce = true;
581 } 580 }
582 581
583 public override void SetMomentum(PhysicsVector momentum) 582 public override void SetMomentum(Vector3 momentum)
584 { 583 {
585 } 584 }
586 585
@@ -778,7 +777,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
778 777
779 } 778 }
780 779
781 if (!_position.IsIdentical(m_taintposition, 0f)) 780 if (!_position.ApproxEquals(m_taintposition, 0f))
782 { 781 {
783 m_log.Debug("[PHYSICS]: TaintMove"); 782 m_log.Debug("[PHYSICS]: TaintMove");
784 changemove(timestep); 783 changemove(timestep);
@@ -796,7 +795,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
796 } 795 }
797 // 796 //
798 797
799 if (!_size.IsIdentical(m_taintsize, 0)) 798 if (!_size.ApproxEquals(m_taintsize, 0f))
800 { 799 {
801 m_log.Debug("[PHYSICS]: TaintSize"); 800 m_log.Debug("[PHYSICS]: TaintSize");
802 changesize(timestep); 801 changesize(timestep);
@@ -820,7 +819,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
820 m_log.Debug("[PHYSICS]: TaintAngularForce"); 819 m_log.Debug("[PHYSICS]: TaintAngularForce");
821 changeAddAngularForce(timestep); 820 changeAddAngularForce(timestep);
822 } 821 }
823 if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f)) 822 if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f))
824 { 823 {
825 m_log.Debug("[PHYSICS]: TaintTorque"); 824 m_log.Debug("[PHYSICS]: TaintTorque");
826 changeSetTorque(timestep); 825 changeSetTorque(timestep);
@@ -835,7 +834,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
835 m_log.Debug("[PHYSICS]: TaintSelected"); 834 m_log.Debug("[PHYSICS]: TaintSelected");
836 changeSelectedStatus(timestep); 835 changeSelectedStatus(timestep);
837 } 836 }
838 if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f)) 837 if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f))
839 { 838 {
840 m_log.Debug("[PHYSICS]: TaintVelocity"); 839 m_log.Debug("[PHYSICS]: TaintVelocity");
841 changevelocity(timestep); 840 changevelocity(timestep);
@@ -849,7 +848,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
849 { 848 {
850 changefloatonwater(timestep); 849 changefloatonwater(timestep);
851 } 850 }
852 if (!m_angularlock.IsIdentical(m_taintAngularLock, 0)) 851 if (!m_angularlock.ApproxEquals(m_taintAngularLock, 0))
853 { 852 {
854 m_log.Debug("[PHYSICS]: TaintAngularLock"); 853 m_log.Debug("[PHYSICS]: TaintAngularLock");
855 changeAngularLock(timestep); 854 changeAngularLock(timestep);
@@ -1012,7 +1011,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1012 { 1011 {
1013 if (_parent_scene.needsMeshing(_pbs)) 1012 if (_parent_scene.needsMeshing(_pbs))
1014 { 1013 {
1015 ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity); 1014 ProcessGeomCreationAsTriMesh(Vector3.Zero, Quaternion.Identity);
1016 // createmesh returns null when it doesn't mesh. 1015 // createmesh returns null when it doesn't mesh.
1017 CreateGeom(IntPtr.Zero, _mesh); 1016 CreateGeom(IntPtr.Zero, _mesh);
1018 } 1017 }
@@ -1029,7 +1028,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1029 return _parent_scene.needsMeshing(_pbs); 1028 return _parent_scene.needsMeshing(_pbs);
1030 } 1029 }
1031 1030
1032 internal void ProcessGeomCreationAsTriMesh(PhysicsVector positionOffset, Quaternion orientation) 1031 internal void ProcessGeomCreationAsTriMesh(Vector3 positionOffset, Quaternion orientation)
1033 { 1032 {
1034 // Don't need to re-enable body.. it's done in SetMesh 1033 // Don't need to re-enable body.. it's done in SetMesh
1035 float meshlod = _parent_scene.meshSculptLOD; 1034 float meshlod = _parent_scene.meshSculptLOD;
@@ -1038,7 +1037,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1038 meshlod = _parent_scene.MeshSculptphysicalLOD; 1037 meshlod = _parent_scene.MeshSculptphysicalLOD;
1039 1038
1040 IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical); 1039 IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical);
1041 if (!positionOffset.IsIdentical(PhysicsVector.Zero, 0.001f) || orientation != Quaternion.Identity) 1040 if (!positionOffset.ApproxEquals(Vector3.Zero, 0.001f) || orientation != Quaternion.Identity)
1042 { 1041 {
1043 1042
1044 float[] xyz = new float[3]; 1043 float[] xyz = new float[3];
@@ -1202,7 +1201,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1202 //m_log.Info("[PHYSICS]: dequeing forcelist"); 1201 //m_log.Info("[PHYSICS]: dequeing forcelist");
1203 if (IsPhysical) 1202 if (IsPhysical)
1204 { 1203 {
1205 PhysicsVector iforce = new PhysicsVector(); 1204 Vector3 iforce = Vector3.Zero;
1206 for (int i = 0; i < m_forcelist.Count; i++) 1205 for (int i = 0; i < m_forcelist.Count; i++)
1207 { 1206 {
1208 iforce = iforce + m_forcelist[i]; 1207 iforce = iforce + m_forcelist[i];
@@ -1237,7 +1236,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1237 //m_log.Info("[PHYSICS]: dequeing forcelist"); 1236 //m_log.Info("[PHYSICS]: dequeing forcelist");
1238 if (IsPhysical) 1237 if (IsPhysical)
1239 { 1238 {
1240 PhysicsVector iforce = new PhysicsVector(); 1239 Vector3 iforce = Vector3.Zero;
1241 for (int i = 0; i < m_angularforcelist.Count; i++) 1240 for (int i = 0; i < m_angularforcelist.Count; i++)
1242 { 1241 {
1243 iforce = iforce + m_angularforcelist[i]; 1242 iforce = iforce + m_angularforcelist[i];
@@ -1276,7 +1275,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1276 } 1275 }
1277 } 1276 }
1278 } 1277 }
1279 m_taintTorque = new PhysicsVector(0, 0, 0); 1278 m_taintTorque = Vector3.Zero;
1280 } 1279 }
1281 1280
1282 private void changedisable(float timestep) 1281 private void changedisable(float timestep)
@@ -1317,7 +1316,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1317 1316
1318 //resetCollisionAccounting(); 1317 //resetCollisionAccounting();
1319 } 1318 }
1320 m_taintVelocity = PhysicsVector.Zero; 1319 m_taintVelocity = Vector3.Zero;
1321 } 1320 }
1322 1321
1323 private void changelink(float timestep) 1322 private void changelink(float timestep)
@@ -1361,7 +1360,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1361 1360
1362 if (m_taintparent != null) 1361 if (m_taintparent != null)
1363 { 1362 {
1364 m_taintparent.Position.Z = m_taintparent.Position.Z + 0.02f; 1363 Vector3 taintparentPosition = m_taintparent.Position;
1364 taintparentPosition.Z = m_taintparent.Position.Z + 0.02f;
1365 m_taintparent.Position = taintparentPosition;
1365 _parent_scene.AddPhysicsActorTaint(m_taintparent); 1366 _parent_scene.AddPhysicsActorTaint(m_taintparent);
1366 } 1367 }
1367 } 1368 }
@@ -1382,7 +1383,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1382 { 1383 {
1383 if (_parent == null) 1384 if (_parent == null)
1384 { 1385 {
1385 if (!m_taintAngularLock.IsIdentical(new PhysicsVector(1f, 1f, 1f), 0)) 1386 if (!m_taintAngularLock.ApproxEquals(Vector3.One, 0f))
1386 { 1387 {
1387 //d.BodySetFiniteRotationMode(Body, 0); 1388 //d.BodySetFiniteRotationMode(Body, 0);
1388 //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z); 1389 //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z);
@@ -1395,7 +1396,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1395 } 1396 }
1396 1397
1397 } 1398 }
1398 m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z); 1399 m_angularlock = m_taintAngularLock;
1399 1400
1400 } 1401 }
1401 #endregion 1402 #endregion
@@ -1460,17 +1461,17 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1460 // TODO: NEED btVector3 for Linear Velocity 1461 // TODO: NEED btVector3 for Linear Velocity
1461 // NEED btVector3 for Position 1462 // NEED btVector3 for Position
1462 1463
1463 PhysicsVector pos = new PhysicsVector(_position.X, _position.Y, _position.Z); //TODO: Insert values gotten from bullet 1464 Vector3 pos = _position; //TODO: Insert values gotten from bullet
1464 PhysicsVector vel = new PhysicsVector(_velocity.X, _velocity.Y, _velocity.Z); 1465 Vector3 vel = _velocity;
1465 1466
1466 _target_velocity = 1467 _target_velocity =
1467 new PhysicsVector( 1468 new Vector3(
1468 (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep), 1469 (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep),
1469 (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep), 1470 (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep),
1470 (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep) 1471 (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep)
1471 ); 1472 );
1472 1473
1473 if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f)) 1474 if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f))
1474 { 1475 {
1475 1476
1476 /* TODO: Do Bullet equiv 1477 /* TODO: Do Bullet equiv
@@ -1512,8 +1513,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1512 { 1513 {
1513 PID_G = m_PIDTau + 1; 1514 PID_G = m_PIDTau + 1;
1514 } 1515 }
1515 PhysicsVector pos = new PhysicsVector(0, 0, 0); //TODO: Insert values gotten from bullet 1516 Vector3 pos = Vector3.Zero; //TODO: Insert values gotten from bullet
1516 PhysicsVector vel = new PhysicsVector(0, 0, 0); 1517 Vector3 vel = Vector3.Zero;
1517 1518
1518 // determine what our target height really is based on HoverType 1519 // determine what our target height really is based on HoverType
1519 switch (m_PIDHoverType) 1520 switch (m_PIDHoverType)
@@ -1545,13 +1546,13 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1545 1546
1546 1547
1547 _target_velocity = 1548 _target_velocity =
1548 new PhysicsVector(0.0f, 0.0f, 1549 new Vector3(0.0f, 0.0f,
1549 (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep) 1550 (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep)
1550 ); 1551 );
1551 1552
1552 // if velocity is zero, use position control; otherwise, velocity control 1553 // if velocity is zero, use position control; otherwise, velocity control
1553 1554
1554 if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f)) 1555 if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f))
1555 { 1556 {
1556 1557
1557 /* TODO: Do Bullet Equiv 1558 /* TODO: Do Bullet Equiv
@@ -1626,8 +1627,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1626 else 1627 else
1627 { 1628 {
1628 if (m_zeroPosition == null) 1629 if (m_zeroPosition == null)
1629 m_zeroPosition = new PhysicsVector(0, 0, 0); 1630 m_zeroPosition = Vector3.Zero;
1630 m_zeroPosition.setValues(_position.X, _position.Y, _position.Z); 1631 m_zeroPosition = _position;
1631 return; 1632 return;
1632 } 1633 }
1633 } 1634 }
@@ -2177,7 +2178,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
2177 2178
2178 //if (hasTrimesh) 2179 //if (hasTrimesh)
2179 //{ 2180 //{
2180 ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity); 2181 ProcessGeomCreationAsTriMesh(Vector3.Zero, Quaternion.Identity);
2181 // createmesh returns null when it doesn't mesh. 2182 // createmesh returns null when it doesn't mesh.
2182 2183
2183 /* 2184 /*
@@ -2197,11 +2198,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
2197 { 2198 {
2198 if (chld == null) 2199 if (chld == null)
2199 continue; 2200 continue;
2200 PhysicsVector offset = chld.Position - Position; 2201 Vector3 offset = chld.Position - Position;
2201 Vector3 pos = new Vector3(offset.X, offset.Y, offset.Z); 2202 Vector3 pos = new Vector3(offset.X, offset.Y, offset.Z);
2202 pos *= Quaternion.Inverse(Orientation); 2203 pos *= Quaternion.Inverse(Orientation);
2203 //pos *= Orientation; 2204 //pos *= Orientation;
2204 offset.setValues(pos.X, pos.Y, pos.Z); 2205 offset = pos;
2205 chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation); 2206 chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation);
2206 2207
2207 _mesh.Append(chld._mesh); 2208 _mesh.Append(chld._mesh);
@@ -2433,7 +2434,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
2433 m_collisionscore = 0; 2434 m_collisionscore = 0;
2434 m_disabled = false; 2435 m_disabled = false;
2435 // The body doesn't already have a finite rotation mode set here 2436 // The body doesn't already have a finite rotation mode set here
2436 if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null) 2437 if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
2437 { 2438 {
2438 // TODO: Create Angular Motor on Axis Lock! 2439 // TODO: Create Angular Motor on Axis Lock!
2439 } 2440 }
@@ -2447,7 +2448,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
2447 { 2448 {
2448 if (_parent == null) 2449 if (_parent == null)
2449 { 2450 {
2450 PhysicsVector pv = new PhysicsVector(0, 0, 0); 2451 Vector3 pv = Vector3.Zero;
2451 bool lastZeroFlag = _zeroFlag; 2452 bool lastZeroFlag = _zeroFlag;
2452 if (tempPosition3 != null && tempPosition3.Handle != IntPtr.Zero) 2453 if (tempPosition3 != null && tempPosition3.Handle != IntPtr.Zero)
2453 tempPosition3.Dispose(); 2454 tempPosition3.Dispose();
@@ -2471,10 +2472,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
2471 tempAngularVelocity1 = Body.getInterpolationAngularVelocity(); //rotvel 2472 tempAngularVelocity1 = Body.getInterpolationAngularVelocity(); //rotvel
2472 tempLinearVelocity1 = Body.getInterpolationLinearVelocity(); // vel 2473 tempLinearVelocity1 = Body.getInterpolationLinearVelocity(); // vel
2473 2474
2474 _torque.setValues(tempAngularVelocity1.getX(), tempAngularVelocity1.getX(), 2475 _torque = new Vector3(tempAngularVelocity1.getX(), tempAngularVelocity1.getX(),
2475 tempAngularVelocity1.getZ()); 2476 tempAngularVelocity1.getZ());
2476 PhysicsVector l_position = new PhysicsVector(); 2477 Vector3 l_position = Vector3.Zero;
2477 Quaternion l_orientation = new Quaternion(); 2478 Quaternion l_orientation = Quaternion.Identity;
2478 m_lastposition = _position; 2479 m_lastposition = _position;
2479 m_lastorientation = _orientation; 2480 m_lastorientation = _orientation;
2480 2481
@@ -2598,20 +2599,18 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
2598 _velocity.Z = tempLinearVelocity1.getZ(); 2599 _velocity.Z = tempLinearVelocity1.getZ();
2599 2600
2600 _acceleration = ((_velocity - m_lastVelocity) / 0.1f); 2601 _acceleration = ((_velocity - m_lastVelocity) / 0.1f);
2601 _acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f, 2602 _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f,
2602 _velocity.Y - m_lastVelocity.Y / 0.1f, 2603 _velocity.Y - m_lastVelocity.Y / 0.1f,
2603 _velocity.Z - m_lastVelocity.Z / 0.1f); 2604 _velocity.Z - m_lastVelocity.Z / 0.1f);
2604 //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); 2605 //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString());
2605 2606
2606 if (_velocity.IsIdentical(pv, 0.5f)) 2607 if (_velocity.ApproxEquals(pv, 0.5f))
2607 { 2608 {
2608 m_rotationalVelocity = pv; 2609 m_rotationalVelocity = pv;
2609 } 2610 }
2610 else 2611 else
2611 { 2612 {
2612 2613 m_rotationalVelocity = new Vector3(tempAngularVelocity1.getX(), tempAngularVelocity1.getY(), tempAngularVelocity1.getZ());
2613 m_rotationalVelocity.setValues(tempAngularVelocity1.getX(), tempAngularVelocity1.getY(),
2614 tempAngularVelocity1.getZ());
2615 } 2614 }
2616 2615
2617 //m_log.Debug("ODE: " + m_rotationalVelocity.ToString()); 2616 //m_log.Debug("ODE: " + m_rotationalVelocity.ToString());
@@ -2665,7 +2664,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
2665 m_taintremove = true; 2664 m_taintremove = true;
2666 } 2665 }
2667 2666
2668 internal void EnableAxisMotor(PhysicsVector axislock) 2667 internal void EnableAxisMotor(Vector3 axislock)
2669 { 2668 {
2670 if (m_aMotor != null) 2669 if (m_aMotor != null)
2671 DisableAxisMotor(); 2670 DisableAxisMotor();
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
index 18d4bab..9e048ab 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
@@ -139,7 +139,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
139 139
140 } 140 }
141 141
142 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) 142 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
143 { 143 {
144 BulletDotNETCharacter chr = new BulletDotNETCharacter(avName, this, position, size, avPIDD, avPIDP, 144 BulletDotNETCharacter chr = new BulletDotNETCharacter(avName, this, position, size, avPIDD, avPIDP,
145 avCapRadius, avStandupTensor, avDensity, 145 avCapRadius, avStandupTensor, avDensity,
@@ -177,14 +177,14 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
177 } 177 }
178 } 178 }
179 179
180 private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, 180 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
181 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) 181 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
182 { 182 {
183 PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z); 183 Vector3 pos = position;
184 //pos.X = position.X; 184 //pos.X = position.X;
185 //pos.Y = position.Y; 185 //pos.Y = position.Y;
186 //pos.Z = position.Z; 186 //pos.Z = position.Z;
187 PhysicsVector siz = new PhysicsVector(); 187 Vector3 siz = Vector3.Zero;
188 siz.X = size.X; 188 siz.X = size.X;
189 siz.Y = size.Y; 189 siz.Y = size.Y;
190 siz.Z = size.Z; 190 siz.Z = size.Z;
@@ -201,12 +201,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
201 return newPrim; 201 return newPrim;
202 } 202 }
203 203
204 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation) 204 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation)
205 { 205 {
206 return AddPrimShape(primName, pbs, position, size, rotation, false); 206 return AddPrimShape(primName, pbs, position, size, rotation, false);
207 } 207 }
208 208
209 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation, bool isPhysical) 209 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical)
210 { 210 {
211 PhysicsActor result; 211 PhysicsActor result;
212 IMesh mesh = null; 212 IMesh mesh = null;
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index abed8df..cbe73bb 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -52,14 +52,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
52 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 52 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 //Vector3 54 //Vector3
55 public static Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector) 55 public static Vector3 PhysicsVectorToXnaVector3(OpenMetaverse.Vector3 physicsVector)
56 { 56 {
57 return new Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z); 57 return new Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z);
58 } 58 }
59 59
60 public static PhysicsVector XnaVector3ToPhysicsVector(Vector3 xnaVector3) 60 public static OpenMetaverse.Vector3 XnaVector3ToPhysicsVector(Vector3 xnaVector3)
61 { 61 {
62 return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z); 62 return new OpenMetaverse.Vector3(xnaVector3.X, xnaVector3.Y, xnaVector3.Z);
63 } 63 }
64 64
65 //Quaternion 65 //Quaternion
@@ -349,7 +349,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
349 vertexBase = new Vector3[iVertexCount]; 349 vertexBase = new Vector3[iVertexCount];
350 for (int i = 0; i < iVertexCount; i++) 350 for (int i = 0; i < iVertexCount; i++)
351 { 351 {
352 PhysicsVector v = mesh.getVertexList()[i]; 352 OpenMetaverse.Vector3 v = mesh.getVertexList()[i];
353 if (v != null) // Note, null has special meaning. See meshing code for details 353 if (v != null) // Note, null has special meaning. See meshing code for details
354 vertexBase[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); 354 vertexBase[i] = BulletXMaths.PhysicsVectorToXnaVector3(v);
355 else 355 else
@@ -392,7 +392,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
392 private int preCheckCollision(BulletXActor actA, Vector3 vNormal, float fDist) 392 private int preCheckCollision(BulletXActor actA, Vector3 vNormal, float fDist)
393 { 393 {
394 float fstartSide; 394 float fstartSide;
395 PhysicsVector v = actA.Position; 395 OpenMetaverse.Vector3 v = actA.Position;
396 Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); 396 Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v);
397 397
398 fstartSide = Vector3.Dot(vNormal, v3) - fDist; 398 fstartSide = Vector3.Dot(vNormal, v3) - fDist;
@@ -404,7 +404,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
404 { 404 {
405 Vector3 perPlaneNormal; 405 Vector3 perPlaneNormal;
406 float fPerPlaneDist; 406 float fPerPlaneDist;
407 PhysicsVector v = actA.Position; 407 OpenMetaverse.Vector3 v = actA.Position;
408 Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); 408 Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v);
409 //check AB 409 //check AB
410 Vector3 v1; 410 Vector3 v1;
@@ -573,9 +573,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin
573 573
574 } 574 }
575 575
576 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) 576 public override PhysicsActor AddAvatar(string avName, OpenMetaverse.Vector3 position, OpenMetaverse.Vector3 size, bool isFlying)
577 { 577 {
578 PhysicsVector pos = new PhysicsVector(); 578 OpenMetaverse.Vector3 pos = OpenMetaverse.Vector3.Zero;
579 pos.X = position.X; 579 pos.X = position.X;
580 pos.Y = position.Y; 580 pos.Y = position.Y;
581 pos.Z = position.Z + 20; 581 pos.Z = position.Z + 20;
@@ -611,14 +611,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
611 } 611 }
612 } 612 }
613 613
614 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 614 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position,
615 PhysicsVector size, OpenMetaverse.Quaternion rotation) 615 OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation)
616 { 616 {
617 return AddPrimShape(primName, pbs, position, size, rotation, false); 617 return AddPrimShape(primName, pbs, position, size, rotation, false);
618 } 618 }
619 619
620 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 620 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position,
621 PhysicsVector size, OpenMetaverse.Quaternion rotation, bool isPhysical) 621 OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, bool isPhysical)
622 { 622 {
623 PhysicsActor result; 623 PhysicsActor result;
624 624
@@ -645,7 +645,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
645 return result; 645 return result;
646 } 646 }
647 647
648 public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, OpenMetaverse.Quaternion rotation, 648 public PhysicsActor AddPrim(String name, OpenMetaverse.Vector3 position, OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation,
649 IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) 649 IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
650 { 650 {
651 BulletXPrim newPrim = null; 651 BulletXPrim newPrim = null;
@@ -879,12 +879,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
879 { 879 {
880 protected bool flying = false; 880 protected bool flying = false;
881 protected bool _physical = false; 881 protected bool _physical = false;
882 protected PhysicsVector _position; 882 protected OpenMetaverse.Vector3 _position;
883 protected PhysicsVector _velocity; 883 protected OpenMetaverse.Vector3 _velocity;
884 protected PhysicsVector _size; 884 protected OpenMetaverse.Vector3 _size;
885 protected PhysicsVector _acceleration; 885 protected OpenMetaverse.Vector3 _acceleration;
886 protected OpenMetaverse.Quaternion _orientation; 886 protected OpenMetaverse.Quaternion _orientation;
887 protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 887 protected OpenMetaverse.Vector3 m_rotationalVelocity;
888 protected RigidBody rigidBody; 888 protected RigidBody rigidBody;
889 protected int m_PhysicsActorType; 889 protected int m_PhysicsActorType;
890 private Boolean iscolliding = false; 890 private Boolean iscolliding = false;
@@ -900,7 +900,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
900 get { return false; } 900 get { return false; }
901 } 901 }
902 902
903 public override PhysicsVector Position 903 public override OpenMetaverse.Vector3 Position
904 { 904 {
905 get { return _position; } 905 get { return _position; }
906 set 906 set
@@ -913,13 +913,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin
913 } 913 }
914 } 914 }
915 915
916 public override PhysicsVector RotationalVelocity 916 public override OpenMetaverse.Vector3 RotationalVelocity
917 { 917 {
918 get { return m_rotationalVelocity; } 918 get { return m_rotationalVelocity; }
919 set { m_rotationalVelocity = value; } 919 set { m_rotationalVelocity = value; }
920 } 920 }
921 921
922 public override PhysicsVector Velocity 922 public override OpenMetaverse.Vector3 Velocity
923 { 923 {
924 get { return _velocity; } 924 get { return _velocity; }
925 set 925 set
@@ -934,7 +934,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
934 } 934 }
935 else 935 else
936 { 936 {
937 _velocity = new PhysicsVector(); 937 _velocity = OpenMetaverse.Vector3.Zero;
938 } 938 }
939 } 939 }
940 } 940 }
@@ -944,7 +944,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
944 get { return 0f; } 944 get { return 0f; }
945 set { } 945 set { }
946 } 946 }
947 public override PhysicsVector Size 947 public override OpenMetaverse.Vector3 Size
948 { 948 {
949 get { return _size; } 949 get { return _size; }
950 set 950 set
@@ -956,9 +956,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin
956 } 956 }
957 } 957 }
958 958
959 public override PhysicsVector Force 959 public override OpenMetaverse.Vector3 Force
960 { 960 {
961 get { return PhysicsVector.Zero; } 961 get { return OpenMetaverse.Vector3.Zero; }
962 set { return; } 962 set { return; }
963 } 963 }
964 964
@@ -973,7 +973,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
973 973
974 } 974 }
975 975
976 public override void VehicleVectorParam(int param, PhysicsVector value) 976 public override void VehicleVectorParam(int param, OpenMetaverse.Vector3 value)
977 { 977 {
978 978
979 } 979 }
@@ -988,14 +988,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
988 988
989 } 989 }
990 990
991 public override PhysicsVector CenterOfMass 991 public override OpenMetaverse.Vector3 CenterOfMass
992 { 992 {
993 get { return PhysicsVector.Zero; } 993 get { return OpenMetaverse.Vector3.Zero; }
994 } 994 }
995 995
996 public override PhysicsVector GeometricCenter 996 public override OpenMetaverse.Vector3 GeometricCenter
997 { 997 {
998 get { return PhysicsVector.Zero; } 998 get { return OpenMetaverse.Vector3.Zero; }
999 } 999 }
1000 1000
1001 public override PrimitiveBaseShape Shape 1001 public override PrimitiveBaseShape Shape
@@ -1009,7 +1009,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1009 set { return; } 1009 set { return; }
1010 } 1010 }
1011 1011
1012 public override PhysicsVector Acceleration 1012 public override OpenMetaverse.Vector3 Acceleration
1013 { 1013 {
1014 get { return _acceleration; } 1014 get { return _acceleration; }
1015 } 1015 }
@@ -1036,7 +1036,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1036 1036
1037 } 1037 }
1038 1038
1039 public override void LockAngularMotion(PhysicsVector axis) 1039 public override void LockAngularMotion(OpenMetaverse.Vector3 axis)
1040 { 1040 {
1041 1041
1042 } 1042 }
@@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1129 set { return; } 1129 set { return; }
1130 } 1130 }
1131 1131
1132 public virtual void SetAcceleration(PhysicsVector accel) 1132 public virtual void SetAcceleration(OpenMetaverse.Vector3 accel)
1133 { 1133 {
1134 lock (BulletXScene.BulletXLock) 1134 lock (BulletXScene.BulletXLock)
1135 { 1135 {
@@ -1143,19 +1143,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1143 set { } 1143 set { }
1144 } 1144 }
1145 1145
1146 public override void AddForce(PhysicsVector force, bool pushforce) 1146 public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce)
1147 { 1147 {
1148 } 1148 }
1149 public override PhysicsVector Torque 1149 public override OpenMetaverse.Vector3 Torque
1150 { 1150 {
1151 get { return PhysicsVector.Zero; } 1151 get { return OpenMetaverse.Vector3.Zero; }
1152 set { return; } 1152 set { return; }
1153 } 1153 }
1154 public override void AddAngularForce(PhysicsVector force, bool pushforce) 1154 public override void AddAngularForce(OpenMetaverse.Vector3 force, bool pushforce)
1155 { 1155 {
1156 } 1156 }
1157 1157
1158 public override void SetMomentum(PhysicsVector momentum) 1158 public override void SetMomentum(OpenMetaverse.Vector3 momentum)
1159 { 1159 {
1160 } 1160 }
1161 1161
@@ -1174,7 +1174,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1174 Translate(_position); 1174 Translate(_position);
1175 } 1175 }
1176 1176
1177 protected internal void Translate(PhysicsVector _newPos) 1177 protected internal void Translate(OpenMetaverse.Vector3 _newPos)
1178 { 1178 {
1179 Vector3 _translation; 1179 Vector3 _translation;
1180 _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition; 1180 _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition;
@@ -1186,7 +1186,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1186 Speed(_velocity); 1186 Speed(_velocity);
1187 } 1187 }
1188 1188
1189 protected internal void Speed(PhysicsVector _newSpeed) 1189 protected internal void Speed(OpenMetaverse.Vector3 _newSpeed)
1190 { 1190 {
1191 Vector3 _speed; 1191 Vector3 _speed;
1192 _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed); 1192 _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed);
@@ -1212,7 +1212,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1212 ReSize(_size); 1212 ReSize(_size);
1213 } 1213 }
1214 1214
1215 protected internal virtual void ReSize(PhysicsVector _newSize) 1215 protected internal virtual void ReSize(OpenMetaverse.Vector3 _newSize)
1216 { 1216 {
1217 } 1217 }
1218 1218
@@ -1227,7 +1227,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1227 { 1227 {
1228 1228
1229 } 1229 }
1230 public override PhysicsVector PIDTarget { set { return; } } 1230 public override OpenMetaverse.Vector3 PIDTarget { set { return; } }
1231 public override bool PIDActive { set { return; } } 1231 public override bool PIDActive { set { return; } }
1232 public override float PIDTau { set { return; } } 1232 public override float PIDTau { set { return; } }
1233 1233
@@ -1256,19 +1256,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1256 /// </summary> 1256 /// </summary>
1257 public class BulletXCharacter : BulletXActor 1257 public class BulletXCharacter : BulletXActor
1258 { 1258 {
1259 public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos) 1259 public BulletXCharacter(BulletXScene parent_scene, OpenMetaverse.Vector3 pos)
1260 : this(String.Empty, parent_scene, pos) 1260 : this(String.Empty, parent_scene, pos)
1261 { 1261 {
1262 } 1262 }
1263 1263
1264 public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos) 1264 public BulletXCharacter(String avName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos)
1265 : this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(), 1265 : this(avName, parent_scene, pos, OpenMetaverse.Vector3.Zero, OpenMetaverse.Vector3.Zero, OpenMetaverse.Vector3.Zero,
1266 OpenMetaverse.Quaternion.Identity) 1266 OpenMetaverse.Quaternion.Identity)
1267 { 1267 {
1268 } 1268 }
1269 1269
1270 public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, 1270 public BulletXCharacter(String avName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 velocity,
1271 PhysicsVector size, PhysicsVector acceleration, OpenMetaverse.Quaternion orientation) 1271 OpenMetaverse.Vector3 size, OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion orientation)
1272 : base(avName) 1272 : base(avName)
1273 { 1273 {
1274 //This fields will be removed. They're temporal 1274 //This fields will be removed. They're temporal
@@ -1323,25 +1323,25 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1323 set { return; } 1323 set { return; }
1324 } 1324 }
1325 1325
1326 public override PhysicsVector Position 1326 public override OpenMetaverse.Vector3 Position
1327 { 1327 {
1328 get { return base.Position; } 1328 get { return base.Position; }
1329 set { base.Position = value; } 1329 set { base.Position = value; }
1330 } 1330 }
1331 1331
1332 public override PhysicsVector Velocity 1332 public override OpenMetaverse.Vector3 Velocity
1333 { 1333 {
1334 get { return base.Velocity; } 1334 get { return base.Velocity; }
1335 set { base.Velocity = value; } 1335 set { base.Velocity = value; }
1336 } 1336 }
1337 1337
1338 public override PhysicsVector Size 1338 public override OpenMetaverse.Vector3 Size
1339 { 1339 {
1340 get { return base.Size; } 1340 get { return base.Size; }
1341 set { base.Size = value; } 1341 set { base.Size = value; }
1342 } 1342 }
1343 1343
1344 public override PhysicsVector Acceleration 1344 public override OpenMetaverse.Vector3 Acceleration
1345 { 1345 {
1346 get { return base.Acceleration; } 1346 get { return base.Acceleration; }
1347 } 1347 }
@@ -1370,17 +1370,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1370 set { base.Kinematic = value; } 1370 set { base.Kinematic = value; }
1371 } 1371 }
1372 1372
1373 public override void SetAcceleration(PhysicsVector accel) 1373 public override void SetAcceleration(OpenMetaverse.Vector3 accel)
1374 { 1374 {
1375 base.SetAcceleration(accel); 1375 base.SetAcceleration(accel);
1376 } 1376 }
1377 1377
1378 public override void AddForce(PhysicsVector force, bool pushforce) 1378 public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce)
1379 { 1379 {
1380 base.AddForce(force, pushforce); 1380 base.AddForce(force, pushforce);
1381 } 1381 }
1382 1382
1383 public override void SetMomentum(PhysicsVector momentum) 1383 public override void SetMomentum(OpenMetaverse.Vector3 momentum)
1384 { 1384 {
1385 base.SetMomentum(momentum); 1385 base.SetMomentum(momentum);
1386 } 1386 }
@@ -1430,7 +1430,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1430 m.Translation = v3; 1430 m.Translation = v3;
1431 rigidBody.WorldTransform = m; 1431 rigidBody.WorldTransform = m;
1432 //When an Avie touch the ground it's vertical velocity it's reduced to ZERO 1432 //When an Avie touch the ground it's vertical velocity it's reduced to ZERO
1433 Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); 1433 Speed(new OpenMetaverse.Vector3(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
1434 } 1434 }
1435 } 1435 }
1436 1436
@@ -1452,7 +1452,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1452 //For now all prims have the same density, all prims are made of water. Be water my friend! :D 1452 //For now all prims have the same density, all prims are made of water. Be water my friend! :D
1453 private const float _density = 1000.0f; 1453 private const float _density = 1000.0f;
1454 private BulletXScene _parent_scene; 1454 private BulletXScene _parent_scene;
1455 private PhysicsVector m_prev_position = new PhysicsVector(0, 0, 0); 1455 private OpenMetaverse.Vector3 m_prev_position;
1456 private bool m_lastUpdateSent = false; 1456 private bool m_lastUpdateSent = false;
1457 //added by jed zhu 1457 //added by jed zhu
1458 private IMesh _mesh; 1458 private IMesh _mesh;
@@ -1460,17 +1460,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1460 1460
1461 1461
1462 1462
1463 public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, 1463 public BulletXPrim(String primName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 size,
1464 OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) 1464 OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
1465 : this( 1465 : this(
1466 primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs, 1466 primName, parent_scene, pos, OpenMetaverse.Vector3.Zero, size, OpenMetaverse.Vector3.Zero, rotation, mesh, pbs,
1467 isPhysical) 1467 isPhysical)
1468 { 1468 {
1469 } 1469 }
1470 1470
1471 public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, 1471 public BulletXPrim(String primName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 velocity,
1472 PhysicsVector size, 1472 OpenMetaverse.Vector3 size,
1473 PhysicsVector acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, 1473 OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs,
1474 bool isPhysical) 1474 bool isPhysical)
1475 : base(primName) 1475 : base(primName)
1476 { 1476 {
@@ -1481,7 +1481,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1481 1481
1482 _position = pos; 1482 _position = pos;
1483 _physical = isPhysical; 1483 _physical = isPhysical;
1484 _velocity = _physical ? velocity : new PhysicsVector(); 1484 _velocity = _physical ? velocity : OpenMetaverse.Vector3.Zero;
1485 _size = size; 1485 _size = size;
1486 _acceleration = acceleration; 1486 _acceleration = acceleration;
1487 _orientation = rotation; 1487 _orientation = rotation;
@@ -1497,19 +1497,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1497 set { return; } 1497 set { return; }
1498 } 1498 }
1499 1499
1500 public override PhysicsVector Position 1500 public override OpenMetaverse.Vector3 Position
1501 { 1501 {
1502 get { return base.Position; } 1502 get { return base.Position; }
1503 set { base.Position = value; } 1503 set { base.Position = value; }
1504 } 1504 }
1505 1505
1506 public override PhysicsVector Velocity 1506 public override OpenMetaverse.Vector3 Velocity
1507 { 1507 {
1508 get { return base.Velocity; } 1508 get { return base.Velocity; }
1509 set { base.Velocity = value; } 1509 set { base.Velocity = value; }
1510 } 1510 }
1511 1511
1512 public override PhysicsVector Size 1512 public override OpenMetaverse.Vector3 Size
1513 { 1513 {
1514 get { return _size; } 1514 get { return _size; }
1515 set 1515 set
@@ -1522,7 +1522,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1522 } 1522 }
1523 } 1523 }
1524 1524
1525 public override PhysicsVector Acceleration 1525 public override OpenMetaverse.Vector3 Acceleration
1526 { 1526 {
1527 get { return base.Acceleration; } 1527 get { return base.Acceleration; }
1528 } 1528 }
@@ -1583,7 +1583,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1583 set { base.Kinematic = value; } 1583 set { base.Kinematic = value; }
1584 } 1584 }
1585 1585
1586 public override void SetAcceleration(PhysicsVector accel) 1586 public override void SetAcceleration(OpenMetaverse.Vector3 accel)
1587 { 1587 {
1588 lock (BulletXScene.BulletXLock) 1588 lock (BulletXScene.BulletXLock)
1589 { 1589 {
@@ -1591,12 +1591,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1591 } 1591 }
1592 } 1592 }
1593 1593
1594 public override void AddForce(PhysicsVector force, bool pushforce) 1594 public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce)
1595 { 1595 {
1596 base.AddForce(force,pushforce); 1596 base.AddForce(force,pushforce);
1597 } 1597 }
1598 1598
1599 public override void SetMomentum(PhysicsVector momentum) 1599 public override void SetMomentum(OpenMetaverse.Vector3 momentum)
1600 { 1600 {
1601 base.SetMomentum(momentum); 1601 base.SetMomentum(momentum);
1602 } 1602 }
@@ -1613,7 +1613,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1613 //When a Prim touch the ground it's vertical velocity it's reduced to ZERO 1613 //When a Prim touch the ground it's vertical velocity it's reduced to ZERO
1614 //Static objects don't have linear velocity 1614 //Static objects don't have linear velocity
1615 if (_physical) 1615 if (_physical)
1616 Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); 1616 Speed(new OpenMetaverse.Vector3(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
1617 } 1617 }
1618 } 1618 }
1619 1619
@@ -1632,7 +1632,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1632 { 1632 {
1633 if (!m_lastUpdateSent) 1633 if (!m_lastUpdateSent)
1634 { 1634 {
1635 _velocity = new PhysicsVector(0, 0, 0); 1635 _velocity = OpenMetaverse.Vector3.Zero;
1636 base.ScheduleTerseUpdate(); 1636 base.ScheduleTerseUpdate();
1637 m_lastUpdateSent = true; 1637 m_lastUpdateSent = true;
1638 } 1638 }
@@ -1654,8 +1654,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1654 1654
1655 #region Methods for updating values of RigidBody 1655 #region Methods for updating values of RigidBody
1656 1656
1657 protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, PhysicsVector pos, 1657 protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, OpenMetaverse.Vector3 pos,
1658 PhysicsVector size) 1658 OpenMetaverse.Vector3 size)
1659 { 1659 {
1660 //For RigidBody Constructor. The next values might change 1660 //For RigidBody Constructor. The next values might change
1661 float _linearDamping = 0.0f; 1661 float _linearDamping = 0.0f;
@@ -1683,7 +1683,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1683 Vector3[] v3Vertices = new Vector3[iVertexCount]; 1683 Vector3[] v3Vertices = new Vector3[iVertexCount];
1684 for (int i = 0; i < iVertexCount; i++) 1684 for (int i = 0; i < iVertexCount; i++)
1685 { 1685 {
1686 PhysicsVector v = mesh.getVertexList()[i]; 1686 OpenMetaverse.Vector3 v = mesh.getVertexList()[i];
1687 if (v != null) // Note, null has special meaning. See meshing code for details 1687 if (v != null) // Note, null has special meaning. See meshing code for details
1688 v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); 1688 v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v);
1689 else 1689 else
@@ -1709,7 +1709,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1709 } 1709 }
1710 } 1710 }
1711 1711
1712 protected internal void ReCreateRigidBody(PhysicsVector size) 1712 protected internal void ReCreateRigidBody(OpenMetaverse.Vector3 size)
1713 { 1713 {
1714 //There is a bug when trying to remove a rigidBody that is colliding with something.. 1714 //There is a bug when trying to remove a rigidBody that is colliding with something..
1715 try 1715 try
@@ -1729,7 +1729,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1729 GC.Collect(); 1729 GC.Collect();
1730 } 1730 }
1731 1731
1732 protected internal override void ReSize(PhysicsVector _newSize) 1732 protected internal override void ReSize(OpenMetaverse.Vector3 _newSize)
1733 { 1733 {
1734 //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't 1734 //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't
1735 //so i have to do it manually. That's recreating rigidbody 1735 //so i have to do it manually. That's recreating rigidbody
@@ -1744,8 +1744,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1744 /// </summary> 1744 /// </summary>
1745 internal class BulletXPlanet 1745 internal class BulletXPlanet
1746 { 1746 {
1747 private PhysicsVector _staticPosition; 1747 private OpenMetaverse.Vector3 _staticPosition;
1748// private PhysicsVector _staticVelocity; 1748// private Vector3 _staticVelocity;
1749// private OpenMetaverse.Quaternion _staticOrientation; 1749// private OpenMetaverse.Quaternion _staticOrientation;
1750 private float _mass; 1750 private float _mass;
1751 // private BulletXScene _parentscene; 1751 // private BulletXScene _parentscene;
@@ -1759,7 +1759,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1759 1759
1760 internal BulletXPlanet(BulletXScene parent_scene, float[] heightField) 1760 internal BulletXPlanet(BulletXScene parent_scene, float[] heightField)
1761 { 1761 {
1762 _staticPosition = new PhysicsVector(BulletXScene.MaxXY/2, BulletXScene.MaxXY/2, 0); 1762 _staticPosition = new OpenMetaverse.Vector3(BulletXScene.MaxXY / 2, BulletXScene.MaxXY / 2, 0);
1763// _staticVelocity = new PhysicsVector(); 1763// _staticVelocity = new PhysicsVector();
1764// _staticOrientation = OpenMetaverse.Quaternion.Identity; 1764// _staticOrientation = OpenMetaverse.Quaternion.Identity;
1765 _mass = 0; //No active 1765 _mass = 0; //No active
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs
index 1a8c948..1181b8d 100644
--- a/OpenSim/Region/Physics/Manager/IMesher.cs
+++ b/OpenSim/Region/Physics/Manager/IMesher.cs
@@ -28,13 +28,14 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenMetaverse;
31 32
32namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.Physics.Manager
33{ 34{
34 public interface IMesher 35 public interface IMesher
35 { 36 {
36 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod); 37 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod);
37 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical); 38 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical);
38 } 39 }
39 40
40 public interface IVertex 41 public interface IVertex
@@ -43,7 +44,7 @@ namespace OpenSim.Region.Physics.Manager
43 44
44 public interface IMesh 45 public interface IMesh
45 { 46 {
46 List<PhysicsVector> getVertexList(); 47 List<Vector3> getVertexList();
47 int[] getIndexListAsInt(); 48 int[] getIndexListAsInt();
48 int[] getIndexListAsIntLocked(); 49 int[] getIndexListAsIntLocked();
49 float[] getVertexListAsFloatLocked(); 50 float[] getVertexListAsFloatLocked();
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 7603131..6bfdff2 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -32,8 +32,8 @@ using OpenMetaverse;
32 32
33namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.Physics.Manager
34{ 34{
35 public delegate void PositionUpdate(PhysicsVector position); 35 public delegate void PositionUpdate(Vector3 position);
36 public delegate void VelocityUpdate(PhysicsVector velocity); 36 public delegate void VelocityUpdate(Vector3 velocity);
37 public delegate void OrientationUpdate(Quaternion orientation); 37 public delegate void OrientationUpdate(Quaternion orientation);
38 38
39 public enum ActorTypes : int 39 public enum ActorTypes : int
@@ -106,7 +106,7 @@ namespace OpenSim.Region.Physics.Manager
106 { 106 {
107 public delegate void RequestTerseUpdate(); 107 public delegate void RequestTerseUpdate();
108 public delegate void CollisionUpdate(EventArgs e); 108 public delegate void CollisionUpdate(EventArgs e);
109 public delegate void OutOfBounds(PhysicsVector pos); 109 public delegate void OutOfBounds(Vector3 pos);
110 110
111// disable warning: public events 111// disable warning: public events
112#pragma warning disable 67 112#pragma warning disable 67
@@ -125,7 +125,7 @@ namespace OpenSim.Region.Physics.Manager
125 125
126 public abstract bool Stopped { get; } 126 public abstract bool Stopped { get; }
127 127
128 public abstract PhysicsVector Size { get; set; } 128 public abstract Vector3 Size { get; set; }
129 129
130 public abstract PrimitiveBaseShape Shape { set; } 130 public abstract PrimitiveBaseShape Shape { set; }
131 131
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Physics.Manager
144 144
145 public abstract void delink(); 145 public abstract void delink();
146 146
147 public abstract void LockAngularMotion(PhysicsVector axis); 147 public abstract void LockAngularMotion(Vector3 axis);
148 148
149 public virtual void RequestPhysicsterseUpdate() 149 public virtual void RequestPhysicsterseUpdate()
150 { 150 {
@@ -159,7 +159,7 @@ namespace OpenSim.Region.Physics.Manager
159 } 159 }
160 } 160 }
161 161
162 public virtual void RaiseOutOfBounds(PhysicsVector pos) 162 public virtual void RaiseOutOfBounds(Vector3 pos)
163 { 163 {
164 // Make a temporary copy of the event to avoid possibility of 164 // Make a temporary copy of the event to avoid possibility of
165 // a race condition if the last subscriber unsubscribes 165 // a race condition if the last subscriber unsubscribes
@@ -187,23 +187,23 @@ namespace OpenSim.Region.Physics.Manager
187 187
188 } 188 }
189 189
190 public abstract PhysicsVector Position { get; set; } 190 public abstract Vector3 Position { get; set; }
191 public abstract float Mass { get; } 191 public abstract float Mass { get; }
192 public abstract PhysicsVector Force { get; set; } 192 public abstract Vector3 Force { get; set; }
193 193
194 public abstract int VehicleType { get; set; } 194 public abstract int VehicleType { get; set; }
195 public abstract void VehicleFloatParam(int param, float value); 195 public abstract void VehicleFloatParam(int param, float value);
196 public abstract void VehicleVectorParam(int param, PhysicsVector value); 196 public abstract void VehicleVectorParam(int param, Vector3 value);
197 public abstract void VehicleRotationParam(int param, Quaternion rotation); 197 public abstract void VehicleRotationParam(int param, Quaternion rotation);
198 198
199 public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more 199 public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
200 200
201 public abstract PhysicsVector GeometricCenter { get; } 201 public abstract Vector3 GeometricCenter { get; }
202 public abstract PhysicsVector CenterOfMass { get; } 202 public abstract Vector3 CenterOfMass { get; }
203 public abstract PhysicsVector Velocity { get; set; } 203 public abstract Vector3 Velocity { get; set; }
204 public abstract PhysicsVector Torque { get; set; } 204 public abstract Vector3 Torque { get; set; }
205 public abstract float CollisionScore { get; set;} 205 public abstract float CollisionScore { get; set;}
206 public abstract PhysicsVector Acceleration { get; } 206 public abstract Vector3 Acceleration { get; }
207 public abstract Quaternion Orientation { get; set; } 207 public abstract Quaternion Orientation { get; set; }
208 public abstract int PhysicsActorType { get; set; } 208 public abstract int PhysicsActorType { get; set; }
209 public abstract bool IsPhysical { get; set; } 209 public abstract bool IsPhysical { get; set; }
@@ -214,12 +214,12 @@ namespace OpenSim.Region.Physics.Manager
214 public abstract bool CollidingGround { get; set; } 214 public abstract bool CollidingGround { get; set; }
215 public abstract bool CollidingObj { get; set; } 215 public abstract bool CollidingObj { get; set; }
216 public abstract bool FloatOnWater { set; } 216 public abstract bool FloatOnWater { set; }
217 public abstract PhysicsVector RotationalVelocity { get; set; } 217 public abstract Vector3 RotationalVelocity { get; set; }
218 public abstract bool Kinematic { get; set; } 218 public abstract bool Kinematic { get; set; }
219 public abstract float Buoyancy { get; set; } 219 public abstract float Buoyancy { get; set; }
220 220
221 // Used for MoveTo 221 // Used for MoveTo
222 public abstract PhysicsVector PIDTarget { set;} 222 public abstract Vector3 PIDTarget { set; }
223 public abstract bool PIDActive { set;} 223 public abstract bool PIDActive { set;}
224 public abstract float PIDTau { set; } 224 public abstract float PIDTau { set; }
225 225
@@ -231,9 +231,9 @@ namespace OpenSim.Region.Physics.Manager
231 public abstract float PIDHoverTau { set;} 231 public abstract float PIDHoverTau { set;}
232 232
233 233
234 public abstract void AddForce(PhysicsVector force, bool pushforce); 234 public abstract void AddForce(Vector3 force, bool pushforce);
235 public abstract void AddAngularForce(PhysicsVector force, bool pushforce); 235 public abstract void AddAngularForce(Vector3 force, bool pushforce);
236 public abstract void SetMomentum(PhysicsVector momentum); 236 public abstract void SetMomentum(Vector3 momentum);
237 public abstract void SubscribeEvents(int ms); 237 public abstract void SubscribeEvents(int ms);
238 public abstract void UnSubscribeEvents(); 238 public abstract void UnSubscribeEvents();
239 public abstract bool SubscribedEvents(); 239 public abstract bool SubscribedEvents();
@@ -246,9 +246,9 @@ namespace OpenSim.Region.Physics.Manager
246 get{ return false; } 246 get{ return false; }
247 } 247 }
248 248
249 public override PhysicsVector Position 249 public override Vector3 Position
250 { 250 {
251 get { return PhysicsVector.Zero; } 251 get { return Vector3.Zero; }
252 set { return; } 252 set { return; }
253 } 253 }
254 254
@@ -296,9 +296,9 @@ namespace OpenSim.Region.Physics.Manager
296 set { return; } 296 set { return; }
297 } 297 }
298 298
299 public override PhysicsVector Size 299 public override Vector3 Size
300 { 300 {
301 get { return PhysicsVector.Zero; } 301 get { return Vector3.Zero; }
302 set { return; } 302 set { return; }
303 } 303 }
304 304
@@ -307,9 +307,9 @@ namespace OpenSim.Region.Physics.Manager
307 get { return 0f; } 307 get { return 0f; }
308 } 308 }
309 309
310 public override PhysicsVector Force 310 public override Vector3 Force
311 { 311 {
312 get { return PhysicsVector.Zero; } 312 get { return Vector3.Zero; }
313 set { return; } 313 set { return; }
314 } 314 }
315 315
@@ -324,7 +324,7 @@ namespace OpenSim.Region.Physics.Manager
324 324
325 } 325 }
326 326
327 public override void VehicleVectorParam(int param, PhysicsVector value) 327 public override void VehicleVectorParam(int param, Vector3 value)
328 { 328 {
329 329
330 } 330 }
@@ -344,14 +344,14 @@ namespace OpenSim.Region.Physics.Manager
344 344
345 } 345 }
346 346
347 public override PhysicsVector CenterOfMass 347 public override Vector3 CenterOfMass
348 { 348 {
349 get { return PhysicsVector.Zero; } 349 get { return Vector3.Zero; }
350 } 350 }
351 351
352 public override PhysicsVector GeometricCenter 352 public override Vector3 GeometricCenter
353 { 353 {
354 get { return PhysicsVector.Zero; } 354 get { return Vector3.Zero; }
355 } 355 }
356 356
357 public override PrimitiveBaseShape Shape 357 public override PrimitiveBaseShape Shape
@@ -359,15 +359,15 @@ namespace OpenSim.Region.Physics.Manager
359 set { return; } 359 set { return; }
360 } 360 }
361 361
362 public override PhysicsVector Velocity 362 public override Vector3 Velocity
363 { 363 {
364 get { return PhysicsVector.Zero; } 364 get { return Vector3.Zero; }
365 set { return; } 365 set { return; }
366 } 366 }
367 367
368 public override PhysicsVector Torque 368 public override Vector3 Torque
369 { 369 {
370 get { return PhysicsVector.Zero; } 370 get { return Vector3.Zero; }
371 set { return; } 371 set { return; }
372 } 372 }
373 373
@@ -387,9 +387,9 @@ namespace OpenSim.Region.Physics.Manager
387 set { } 387 set { }
388 } 388 }
389 389
390 public override PhysicsVector Acceleration 390 public override Vector3 Acceleration
391 { 391 {
392 get { return PhysicsVector.Zero; } 392 get { return Vector3.Zero; }
393 } 393 }
394 394
395 public override bool IsPhysical 395 public override bool IsPhysical
@@ -436,26 +436,26 @@ namespace OpenSim.Region.Physics.Manager
436 { 436 {
437 } 437 }
438 438
439 public override void LockAngularMotion(PhysicsVector axis) 439 public override void LockAngularMotion(Vector3 axis)
440 { 440 {
441 } 441 }
442 442
443 public override void AddForce(PhysicsVector force, bool pushforce) 443 public override void AddForce(Vector3 force, bool pushforce)
444 { 444 {
445 } 445 }
446 446
447 public override void AddAngularForce(PhysicsVector force, bool pushforce) 447 public override void AddAngularForce(Vector3 force, bool pushforce)
448 { 448 {
449 449
450 } 450 }
451 451
452 public override PhysicsVector RotationalVelocity 452 public override Vector3 RotationalVelocity
453 { 453 {
454 get { return PhysicsVector.Zero; } 454 get { return Vector3.Zero; }
455 set { return; } 455 set { return; }
456 } 456 }
457 457
458 public override PhysicsVector PIDTarget { set { return; } } 458 public override Vector3 PIDTarget { set { return; } }
459 public override bool PIDActive { set { return; } } 459 public override bool PIDActive { set { return; } }
460 public override float PIDTau { set { return; } } 460 public override float PIDTau { set { return; } }
461 461
@@ -464,7 +464,7 @@ namespace OpenSim.Region.Physics.Manager
464 public override PIDHoverType PIDHoverType { set { return; } } 464 public override PIDHoverType PIDHoverType { set { return; } }
465 public override float PIDHoverTau { set { return; } } 465 public override float PIDHoverTau { set { return; } }
466 466
467 public override void SetMomentum(PhysicsVector momentum) 467 public override void SetMomentum(Vector3 momentum)
468 { 468 {
469 } 469 }
470 470
diff --git a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs b/OpenSim/Region/Physics/Manager/PhysicsJoint.cs
index f463597..b685d04 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsJoint.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Physics.Manager
44 public PhysicsJointType Type; 44 public PhysicsJointType Type;
45 public string RawParams; 45 public string RawParams;
46 public List<string> BodyNames = new List<string>(); 46 public List<string> BodyNames = new List<string>();
47 public PhysicsVector Position; // global coords 47 public Vector3 Position; // global coords
48 public Quaternion Rotation; // global coords 48 public Quaternion Rotation; // global coords
49 public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation 49 public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation
50 public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName) 50 public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName)
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 6dd26bb..bb0d18e 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -64,23 +64,23 @@ namespace OpenSim.Region.Physics.Manager
64 64
65 public abstract void Initialise(IMesher meshmerizer, IConfigSource config); 65 public abstract void Initialise(IMesher meshmerizer, IConfigSource config);
66 66
67 public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying); 67 public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying);
68 68
69 public abstract void RemoveAvatar(PhysicsActor actor); 69 public abstract void RemoveAvatar(PhysicsActor actor);
70 70
71 public abstract void RemovePrim(PhysicsActor prim); 71 public abstract void RemovePrim(PhysicsActor prim);
72 72
73 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 73 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
74 PhysicsVector size, Quaternion rotation); //To be removed 74 Vector3 size, Quaternion rotation); //To be removed
75 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 75 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
76 PhysicsVector size, Quaternion rotation, bool isPhysical); 76 Vector3 size, Quaternion rotation, bool isPhysical);
77 77
78 public virtual bool SupportsNINJAJoints 78 public virtual bool SupportsNINJAJoints
79 { 79 {
80 get { return false; } 80 get { return false; }
81 } 81 }
82 82
83 public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position, 83 public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position,
84 Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation) 84 Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation)
85 { return null; } 85 { return null; }
86 86
@@ -129,11 +129,11 @@ namespace OpenSim.Region.Physics.Manager
129 } 129 }
130 } 130 }
131 131
132 public virtual PhysicsVector GetJointAnchor(PhysicsJoint joint) 132 public virtual Vector3 GetJointAnchor(PhysicsJoint joint)
133 { return null; } 133 { return Vector3.Zero; }
134 134
135 public virtual PhysicsVector GetJointAxis(PhysicsJoint joint) 135 public virtual Vector3 GetJointAxis(PhysicsJoint joint)
136 { return null; } 136 { return Vector3.Zero; }
137 137
138 138
139 public abstract void AddPhysicsActorTaint(PhysicsActor prim); 139 public abstract void AddPhysicsActorTaint(PhysicsActor prim);
@@ -212,7 +212,7 @@ namespace OpenSim.Region.Physics.Manager
212 // Does nothing right now 212 // Does nothing right now
213 } 213 }
214 214
215 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) 215 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
216 { 216 {
217 m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position); 217 m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position);
218 return PhysicsActor.Null; 218 return PhysicsActor.Null;
@@ -231,21 +231,21 @@ namespace OpenSim.Region.Physics.Manager
231 } 231 }
232 232
233/* 233/*
234 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) 234 public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
235 { 235 {
236 m_log.InfoFormat("NullPhysicsScene : AddPrim({0},{1})", position, size); 236 m_log.InfoFormat("NullPhysicsScene : AddPrim({0},{1})", position, size);
237 return PhysicsActor.Null; 237 return PhysicsActor.Null;
238 } 238 }
239*/ 239*/
240 240
241 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 241 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
242 PhysicsVector size, Quaternion rotation) //To be removed 242 Vector3 size, Quaternion rotation) //To be removed
243 { 243 {
244 return AddPrimShape(primName, pbs, position, size, rotation, false); 244 return AddPrimShape(primName, pbs, position, size, rotation, false);
245 } 245 }
246 246
247 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 247 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
248 PhysicsVector size, Quaternion rotation, bool isPhysical) 248 Vector3 size, Quaternion rotation, bool isPhysical)
249 { 249 {
250 m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size); 250 m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size);
251 return PhysicsActor.Null; 251 return PhysicsActor.Null;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs b/OpenSim/Region/Physics/Manager/PhysicsSensor.cs
index 090ad52..f480d71 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsSensor.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Timers; 29using System.Timers;
30using OpenMetaverse;
30 31
31namespace OpenSim.Region.Physics.Manager 32namespace OpenSim.Region.Physics.Manager
32{ 33{
@@ -46,7 +47,7 @@ namespace OpenSim.Region.Physics.Manager
46 { 47 {
47 get { return new NullPhysicsSensor(); } 48 get { return new NullPhysicsSensor(); }
48 } 49 }
49 public abstract PhysicsVector Position {get; set;} 50 public abstract Vector3 Position { get; set; }
50 public abstract void TimerCallback (object obj, ElapsedEventArgs eea); 51 public abstract void TimerCallback (object obj, ElapsedEventArgs eea);
51 public abstract float radianarc {get; set;} 52 public abstract float radianarc {get; set;}
52 public abstract string targetname {get; set;} 53 public abstract string targetname {get; set;}
@@ -58,9 +59,9 @@ namespace OpenSim.Region.Physics.Manager
58 59
59 public class NullPhysicsSensor : PhysicsSensor 60 public class NullPhysicsSensor : PhysicsSensor
60 { 61 {
61 public override PhysicsVector Position 62 public override Vector3 Position
62 { 63 {
63 get { return PhysicsVector.Zero; } 64 get { return Vector3.Zero; }
64 set { return; } 65 set { return; }
65 } 66 }
66 public override void TimerCallback(object obj, ElapsedEventArgs eea) 67 public override void TimerCallback(object obj, ElapsedEventArgs eea)
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
index d6f4d0d..f60a636 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
@@ -29,24 +29,24 @@ using System;
29 29
30namespace OpenSim.Region.Physics.Manager 30namespace OpenSim.Region.Physics.Manager
31{ 31{
32 public class PhysicsVector 32 /*public class PhysicsVector
33 { 33 {
34 public float X; 34 public float X;
35 public float Y; 35 public float Y;
36 public float Z; 36 public float Z;
37 37
38 public PhysicsVector() 38 public Vector3()
39 { 39 {
40 } 40 }
41 41
42 public PhysicsVector(float x, float y, float z) 42 public Vector3(float x, float y, float z)
43 { 43 {
44 X = x; 44 X = x;
45 Y = y; 45 Y = y;
46 Z = z; 46 Z = z;
47 } 47 }
48 48
49 public PhysicsVector(PhysicsVector pv) : this(pv.X, pv.Y, pv.Z) 49 public Vector3(Vector3 pv) : this(pv.X, pv.Y, pv.Z)
50 { 50 {
51 } 51 }
52 52
@@ -115,17 +115,17 @@ namespace OpenSim.Region.Physics.Manager
115 } 115 }
116 116
117 // Operations 117 // Operations
118 public static PhysicsVector operator +(PhysicsVector a, PhysicsVector b) 118 public static PhysicsVector operator +(Vector3 a, Vector3 b)
119 { 119 {
120 return new PhysicsVector(a.X + b.X, a.Y + b.Y, a.Z + b.Z); 120 return new PhysicsVector(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
121 } 121 }
122 122
123 public static PhysicsVector operator -(PhysicsVector a, PhysicsVector b) 123 public static PhysicsVector operator -(Vector3 a, Vector3 b)
124 { 124 {
125 return new PhysicsVector(a.X - b.X, a.Y - b.Y, a.Z - b.Z); 125 return new PhysicsVector(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
126 } 126 }
127 127
128 public static PhysicsVector cross(PhysicsVector a, PhysicsVector b) 128 public static PhysicsVector cross(Vector3 a, Vector3 b)
129 { 129 {
130 return new PhysicsVector(a.Y*b.Z - a.Z*b.Y, a.Z*b.X - a.X*b.Z, a.X*b.Y - a.Y*b.X); 130 return new PhysicsVector(a.Y*b.Z - a.Z*b.Y, a.Z*b.X - a.X*b.Z, a.X*b.Y - a.Y*b.X);
131 } 131 }
@@ -135,7 +135,7 @@ namespace OpenSim.Region.Physics.Manager
135 return (float) Math.Sqrt(X*X + Y*Y + Z*Z); 135 return (float) Math.Sqrt(X*X + Y*Y + Z*Z);
136 } 136 }
137 137
138 public static float GetDistanceTo(PhysicsVector a, PhysicsVector b) 138 public static float GetDistanceTo(Vector3 a, Vector3 b)
139 { 139 {
140 float dx = a.X - b.X; 140 float dx = a.X - b.X;
141 float dy = a.Y - b.Y; 141 float dy = a.Y - b.Y;
@@ -143,22 +143,22 @@ namespace OpenSim.Region.Physics.Manager
143 return (float) Math.Sqrt(dx * dx + dy * dy + dz * dz); 143 return (float) Math.Sqrt(dx * dx + dy * dy + dz * dz);
144 } 144 }
145 145
146 public static PhysicsVector operator /(PhysicsVector v, float f) 146 public static PhysicsVector operator /(Vector3 v, float f)
147 { 147 {
148 return new PhysicsVector(v.X/f, v.Y/f, v.Z/f); 148 return new PhysicsVector(v.X/f, v.Y/f, v.Z/f);
149 } 149 }
150 150
151 public static PhysicsVector operator *(PhysicsVector v, float f) 151 public static PhysicsVector operator *(Vector3 v, float f)
152 { 152 {
153 return new PhysicsVector(v.X*f, v.Y*f, v.Z*f); 153 return new PhysicsVector(v.X*f, v.Y*f, v.Z*f);
154 } 154 }
155 155
156 public static PhysicsVector operator *(float f, PhysicsVector v) 156 public static PhysicsVector operator *(float f, Vector3 v)
157 { 157 {
158 return v*f; 158 return v*f;
159 } 159 }
160 160
161 public static bool isFinite(PhysicsVector v) 161 public static bool isFinite(Vector3 v)
162 { 162 {
163 if (v == null) 163 if (v == null)
164 return false; 164 return false;
@@ -172,7 +172,7 @@ namespace OpenSim.Region.Physics.Manager
172 return true; 172 return true;
173 } 173 }
174 174
175 public virtual bool IsIdentical(PhysicsVector v, float tolerance) 175 public virtual bool IsIdentical(Vector3 v, float tolerance)
176 { 176 {
177 PhysicsVector diff = this - v; 177 PhysicsVector diff = this - v;
178 float d = diff.length(); 178 float d = diff.length();
@@ -182,5 +182,5 @@ namespace OpenSim.Region.Physics.Manager
182 return false; 182 return false;
183 } 183 }
184 184
185 } 185 }*/
186} 186}
diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs
index 81eeed2..e6e75f9 100644
--- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs
+++ b/OpenSim/Region/Physics/Manager/ZeroMesher.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenMetaverse;
30 31
31/* 32/*
32 * This is the zero mesher. 33 * This is the zero mesher.
@@ -60,12 +61,12 @@ namespace OpenSim.Region.Physics.Manager
60 61
61 public class ZeroMesher : IMesher 62 public class ZeroMesher : IMesher
62 { 63 {
63 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod) 64 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
64 { 65 {
65 return CreateMesh(primName, primShape, size, lod, false); 66 return CreateMesh(primName, primShape, size, lod, false);
66 } 67 }
67 68
68 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical) 69 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
69 { 70 {
70 // Remove the reference to the encoded JPEG2000 data so it can be GCed 71 // Remove the reference to the encoded JPEG2000 data so it can be GCed
71 primShape.SculptData = OpenMetaverse.Utils.EmptyBytes; 72 primShape.SculptData = OpenMetaverse.Utils.EmptyBytes;
diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/Meshing/HelperTypes.cs
index 232245f..8cd8dcf 100644
--- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs
+++ b/OpenSim/Region/Physics/Meshing/HelperTypes.cs
@@ -33,30 +33,52 @@ using OpenMetaverse;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.Physics.Manager;
34using OpenSim.Region.Physics.Meshing; 34using OpenSim.Region.Physics.Meshing;
35 35
36public class Vertex : PhysicsVector, IComparable<Vertex> 36public class Vertex : IComparable<Vertex>
37{ 37{
38 Vector3 vector;
39
40 public float X
41 {
42 get { return vector.X; }
43 set { vector.X = value; }
44 }
45
46 public float Y
47 {
48 get { return vector.Y; }
49 set { vector.Y = value; }
50 }
51
52 public float Z
53 {
54 get { return vector.Z; }
55 set { vector.Z = value; }
56 }
57
38 public Vertex(float x, float y, float z) 58 public Vertex(float x, float y, float z)
39 : base(x, y, z)
40 { 59 {
60 vector.X = x;
61 vector.Y = y;
62 vector.Z = z;
41 } 63 }
42 64
43 public Vertex normalize() 65 public Vertex normalize()
44 { 66 {
45 float tlength = length(); 67 float tlength = vector.Length();
46 if (tlength != 0) 68 if (tlength != 0f)
47 { 69 {
48 float mul = 1.0f / tlength; 70 float mul = 1.0f / tlength;
49 return new Vertex(X * mul, Y * mul, Z * mul); 71 return new Vertex(vector.X * mul, vector.Y * mul, vector.Z * mul);
50 } 72 }
51 else 73 else
52 { 74 {
53 return new Vertex(0, 0, 0); 75 return new Vertex(0f, 0f, 0f);
54 } 76 }
55 } 77 }
56 78
57 public Vertex cross(Vertex v) 79 public Vertex cross(Vertex v)
58 { 80 {
59 return new Vertex(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X); 81 return new Vertex(vector.Y * v.Z - vector.Z * v.Y, vector.Z * v.X - vector.X * v.Z, vector.X * v.Y - vector.Y * v.X);
60 } 82 }
61 83
62 // disable warning: mono compiler moans about overloading 84 // disable warning: mono compiler moans about overloading
@@ -160,9 +182,9 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
160 return X * v.X + Y * v.Y + Z * v.Z; 182 return X * v.X + Y * v.Y + Z * v.Z;
161 } 183 }
162 184
163 public Vertex(PhysicsVector v) 185 public Vertex(Vector3 v)
164 : base(v.X, v.Y, v.Z)
165 { 186 {
187 vector = v;
166 } 188 }
167 189
168 public Vertex Clone() 190 public Vertex Clone()
@@ -175,11 +197,15 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
175 return new Vertex((float) Math.Cos(angle), (float) Math.Sin(angle), 0.0f); 197 return new Vertex((float) Math.Cos(angle), (float) Math.Sin(angle), 0.0f);
176 } 198 }
177 199
200 public float Length()
201 {
202 return vector.Length();
203 }
178 204
179 public virtual bool Equals(Vertex v, float tolerance) 205 public virtual bool Equals(Vertex v, float tolerance)
180 { 206 {
181 PhysicsVector diff = this - v; 207 Vertex diff = this - v;
182 float d = diff.length(); 208 float d = diff.Length();
183 if (d < tolerance) 209 if (d < tolerance)
184 return true; 210 return true;
185 211
@@ -369,22 +395,22 @@ public class Triangle
369 return s1 + ";" + s2 + ";" + s3; 395 return s1 + ";" + s2 + ";" + s3;
370 } 396 }
371 397
372 public PhysicsVector getNormal() 398 public Vector3 getNormal()
373 { 399 {
374 // Vertices 400 // Vertices
375 401
376 // Vectors for edges 402 // Vectors for edges
377 PhysicsVector e1; 403 Vector3 e1;
378 PhysicsVector e2; 404 Vector3 e2;
379 405
380 e1 = new PhysicsVector(v1.X - v2.X, v1.Y - v2.Y, v1.Z - v2.Z); 406 e1 = new Vector3(v1.X - v2.X, v1.Y - v2.Y, v1.Z - v2.Z);
381 e2 = new PhysicsVector(v1.X - v3.X, v1.Y - v3.Y, v1.Z - v3.Z); 407 e2 = new Vector3(v1.X - v3.X, v1.Y - v3.Y, v1.Z - v3.Z);
382 408
383 // Cross product for normal 409 // Cross product for normal
384 PhysicsVector n = PhysicsVector.cross(e1, e2); 410 Vector3 n = Vector3.Cross(e1, e2);
385 411
386 // Length 412 // Length
387 float l = n.length(); 413 float l = n.Length();
388 414
389 // Normalized "normal" 415 // Normalized "normal"
390 n = n/l; 416 n = n/l;
diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs
index e8a3e19..f781ff9 100644
--- a/OpenSim/Region/Physics/Meshing/Mesh.cs
+++ b/OpenSim/Region/Physics/Meshing/Mesh.cs
@@ -31,6 +31,7 @@ using System.IO;
31using System.Runtime.InteropServices; 31using System.Runtime.InteropServices;
32using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.Physics.Manager;
33using PrimMesher; 33using PrimMesher;
34using OpenMetaverse;
34 35
35namespace OpenSim.Region.Physics.Meshing 36namespace OpenSim.Region.Physics.Meshing
36{ 37{
@@ -141,12 +142,12 @@ namespace OpenSim.Region.Physics.Meshing
141 } 142 }
142 } 143 }
143 144
144 public List<PhysicsVector> getVertexList() 145 public List<Vector3> getVertexList()
145 { 146 {
146 List<PhysicsVector> result = new List<PhysicsVector>(); 147 List<Vector3> result = new List<Vector3>();
147 foreach (Vertex v in m_vertices.Keys) 148 foreach (Vertex v in m_vertices.Keys)
148 { 149 {
149 result.Add(v); 150 result.Add(new Vector3(v.X, v.Y, v.Z));
150 } 151 }
151 return result; 152 return result;
152 } 153 }
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 01093e2..a90a89a 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -61,7 +61,6 @@ namespace OpenSim.Region.Physics.Meshing
61 public class Meshmerizer : IMesher 61 public class Meshmerizer : IMesher
62 { 62 {
63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
64 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
65 64
66 // Setting baseDir to a path will enable the dumping of raw files 65 // Setting baseDir to a path will enable the dumping of raw files
67 // raw files can be imported by blender so a visual inspection of the results can be done 66 // raw files can be imported by blender so a visual inspection of the results can be done
@@ -160,7 +159,7 @@ namespace OpenSim.Region.Physics.Meshing
160 float minZ = float.MaxValue; 159 float minZ = float.MaxValue;
161 float maxZ = float.MinValue; 160 float maxZ = float.MinValue;
162 161
163 foreach (Vertex v in meshIn.getVertexList()) 162 foreach (Vector3 v in meshIn.getVertexList())
164 { 163 {
165 if (v != null) 164 if (v != null)
166 { 165 {
@@ -185,7 +184,7 @@ namespace OpenSim.Region.Physics.Meshing
185 184
186 } 185 }
187 186
188 private ulong GetMeshKey(PrimitiveBaseShape pbs, PhysicsVector size, float lod) 187 private ulong GetMeshKey(PrimitiveBaseShape pbs, Vector3 size, float lod)
189 { 188 {
190 ulong hash = 5381; 189 ulong hash = 5381;
191 190
@@ -245,9 +244,9 @@ namespace OpenSim.Region.Physics.Meshing
245 hash = ((hash << 5) + hash) + (ulong)((byte)c); 244 hash = ((hash << 5) + hash) + (ulong)((byte)c);
246 return ((hash << 5) + hash) + (ulong)(c >> 8); 245 return ((hash << 5) + hash) + (ulong)(c >> 8);
247 } 246 }
248
249 247
250 private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod) 248
249 private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
251 { 250 {
252 PrimMesh primMesh; 251 PrimMesh primMesh;
253 PrimMesher.SculptMesh sculptMesh; 252 PrimMesher.SculptMesh sculptMesh;
@@ -289,9 +288,6 @@ namespace OpenSim.Region.Physics.Meshing
289 ManagedImage managedImage; // we never use this 288 ManagedImage managedImage; // we never use this
290 OpenJPEG.DecodeToImage(primShape.SculptData, out managedImage, out idata); 289 OpenJPEG.DecodeToImage(primShape.SculptData, out managedImage, out idata);
291 290
292 // Remove the reference to the encoded JPEG2000 data so it can be GCed
293 primShape.SculptData = Utils.EmptyBytes;
294
295 if (cacheSculptMaps) 291 if (cacheSculptMaps)
296 { 292 {
297 try { idata.Save(decodedSculptFileName, ImageFormat.MemoryBmp); } 293 try { idata.Save(decodedSculptFileName, ImageFormat.MemoryBmp); }
@@ -315,8 +311,6 @@ namespace OpenSim.Region.Physics.Meshing
315 } 311 }
316 } 312 }
317 313
318
319
320 PrimMesher.SculptMesh.SculptType sculptType; 314 PrimMesher.SculptMesh.SculptType sculptType;
321 switch ((OpenMetaverse.SculptType)primShape.SculptType) 315 switch ((OpenMetaverse.SculptType)primShape.SculptType)
322 { 316 {
@@ -351,7 +345,6 @@ namespace OpenSim.Region.Physics.Meshing
351 coords = sculptMesh.coords; 345 coords = sculptMesh.coords;
352 faces = sculptMesh.faces; 346 faces = sculptMesh.faces;
353 } 347 }
354
355 else 348 else
356 { 349 {
357 float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f; 350 float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f;
@@ -466,6 +459,8 @@ namespace OpenSim.Region.Physics.Meshing
466 faces = primMesh.faces; 459 faces = primMesh.faces;
467 } 460 }
468 461
462 // Remove the reference to any JPEG2000 sculpt data so it can be GCed
463 primShape.SculptData = Utils.EmptyBytes;
469 464
470 int numCoords = coords.Count; 465 int numCoords = coords.Count;
471 int numFaces = faces.Count; 466 int numFaces = faces.Count;
@@ -488,12 +483,12 @@ namespace OpenSim.Region.Physics.Meshing
488 return mesh; 483 return mesh;
489 } 484 }
490 485
491 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod) 486 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
492 { 487 {
493 return CreateMesh(primName, primShape, size, lod, false); 488 return CreateMesh(primName, primShape, size, lod, false);
494 } 489 }
495 490
496 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical) 491 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
497 { 492 {
498 Mesh mesh = null; 493 Mesh mesh = null;
499 ulong key = 0; 494 ulong key = 0;
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 71ace16..c86bc62 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -68,15 +68,15 @@ namespace OpenSim.Region.Physics.OdePlugin
68 { 68 {
69 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 69 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
70 70
71 private PhysicsVector _position; 71 private Vector3 _position;
72 private d.Vector3 _zeroPosition; 72 private d.Vector3 _zeroPosition;
73 // private d.Matrix3 m_StandUpRotation; 73 // private d.Matrix3 m_StandUpRotation;
74 private bool _zeroFlag = false; 74 private bool _zeroFlag = false;
75 private bool m_lastUpdateSent = false; 75 private bool m_lastUpdateSent = false;
76 private PhysicsVector _velocity; 76 private Vector3 _velocity;
77 private PhysicsVector _target_velocity; 77 private Vector3 _target_velocity;
78 private PhysicsVector _acceleration; 78 private Vector3 _acceleration;
79 private PhysicsVector m_rotationalVelocity; 79 private Vector3 m_rotationalVelocity;
80 private float m_mass = 80f; 80 private float m_mass = 80f;
81 public float m_density = 60f; 81 public float m_density = 60f;
82 private bool m_pidControllerActive = true; 82 private bool m_pidControllerActive = true;
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Physics.OdePlugin
99 private bool m_hackSentFall = false; 99 private bool m_hackSentFall = false;
100 private bool m_hackSentFly = false; 100 private bool m_hackSentFly = false;
101 private int m_requestedUpdateFrequency = 0; 101 private int m_requestedUpdateFrequency = 0;
102 private PhysicsVector m_taintPosition = new PhysicsVector(0, 0, 0); 102 private Vector3 m_taintPosition = Vector3.Zero;
103 public uint m_localID = 0; 103 public uint m_localID = 0;
104 public bool m_returnCollisions = false; 104 public bool m_returnCollisions = false;
105 // taints and their non-tainted counterparts 105 // taints and their non-tainted counterparts
@@ -143,22 +143,17 @@ namespace OpenSim.Region.Physics.OdePlugin
143 public UUID m_uuid; 143 public UUID m_uuid;
144 public bool bad = false; 144 public bool bad = false;
145 145
146 public OdeCharacter(String avName, OdeScene parent_scene, PhysicsVector pos, CollisionLocker dode, PhysicsVector size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) 146 public OdeCharacter(String avName, OdeScene parent_scene, Vector3 pos, CollisionLocker dode, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
147 { 147 {
148 m_uuid = UUID.Random(); 148 m_uuid = UUID.Random();
149 149
150 // ode = dode; 150 if (pos.IsFinite())
151 _velocity = new PhysicsVector();
152 _target_velocity = new PhysicsVector();
153
154
155 if (PhysicsVector.isFinite(pos))
156 { 151 {
157 if (pos.Z > 9999999) 152 if (pos.Z > 9999999f)
158 { 153 {
159 pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; 154 pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
160 } 155 }
161 if (pos.Z < -90000) 156 if (pos.Z < -90000f)
162 { 157 {
163 pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; 158 pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
164 } 159 }
@@ -169,15 +164,13 @@ namespace OpenSim.Region.Physics.OdePlugin
169 } 164 }
170 else 165 else
171 { 166 {
172 _position = new PhysicsVector(((int)_parent_scene.WorldExtents.X * 0.5f), ((int)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128, 128) + 10); 167 _position = new Vector3(((float)_parent_scene.WorldExtents.X * 0.5f), ((float)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f);
173 m_taintPosition.X = _position.X; 168 m_taintPosition.X = _position.X;
174 m_taintPosition.Y = _position.Y; 169 m_taintPosition.Y = _position.Y;
175 m_taintPosition.Z = _position.Z; 170 m_taintPosition.Z = _position.Z;
176 m_log.Warn("[PHYSICS]: Got NaN Position on Character Create"); 171 m_log.Warn("[PHYSICS]: Got NaN Position on Character Create");
177 } 172 }
178 173
179
180 _acceleration = new PhysicsVector();
181 _parent_scene = parent_scene; 174 _parent_scene = parent_scene;
182 175
183 PID_D = pid_d; 176 PID_D = pid_d;
@@ -189,7 +182,6 @@ namespace OpenSim.Region.Physics.OdePlugin
189 walkDivisor = walk_divisor; 182 walkDivisor = walk_divisor;
190 runDivisor = rundivisor; 183 runDivisor = rundivisor;
191 184
192
193 // m_StandUpRotation = 185 // m_StandUpRotation =
194 // new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f, 186 // new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f,
195 // 0.5f); 187 // 0.5f);
@@ -205,7 +197,6 @@ namespace OpenSim.Region.Physics.OdePlugin
205 m_isPhysical = false; // current status: no ODE information exists 197 m_isPhysical = false; // current status: no ODE information exists
206 m_tainted_isPhysical = true; // new tainted status: need to create ODE information 198 m_tainted_isPhysical = true; // new tainted status: need to create ODE information
207 199
208
209 _parent_scene.AddPhysicsActorTaint(this); 200 _parent_scene.AddPhysicsActorTaint(this);
210 201
211 m_name = avName; 202 m_name = avName;
@@ -412,20 +403,20 @@ namespace OpenSim.Region.Physics.OdePlugin
412 /// Not really a good choice unless you 'know' it's a good 403 /// Not really a good choice unless you 'know' it's a good
413 /// spot otherwise you're likely to orbit the avatar. 404 /// spot otherwise you're likely to orbit the avatar.
414 /// </summary> 405 /// </summary>
415 public override PhysicsVector Position 406 public override Vector3 Position
416 { 407 {
417 get { return _position; } 408 get { return _position; }
418 set 409 set
419 { 410 {
420 if (Body == IntPtr.Zero || Shell == IntPtr.Zero) 411 if (Body == IntPtr.Zero || Shell == IntPtr.Zero)
421 { 412 {
422 if (PhysicsVector.isFinite(value)) 413 if (value.IsFinite())
423 { 414 {
424 if (value.Z > 9999999) 415 if (value.Z > 9999999f)
425 { 416 {
426 value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; 417 value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
427 } 418 }
428 if (value.Z < -90000) 419 if (value.Z < -90000f)
429 { 420 {
430 value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; 421 value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
431 } 422 }
@@ -447,7 +438,7 @@ namespace OpenSim.Region.Physics.OdePlugin
447 } 438 }
448 } 439 }
449 440
450 public override PhysicsVector RotationalVelocity 441 public override Vector3 RotationalVelocity
451 { 442 {
452 get { return m_rotationalVelocity; } 443 get { return m_rotationalVelocity; }
453 set { m_rotationalVelocity = value; } 444 set { m_rotationalVelocity = value; }
@@ -457,20 +448,20 @@ namespace OpenSim.Region.Physics.OdePlugin
457 /// This property sets the height of the avatar only. We use the height to make sure the avatar stands up straight 448 /// This property sets the height of the avatar only. We use the height to make sure the avatar stands up straight
458 /// and use it to offset landings properly 449 /// and use it to offset landings properly
459 /// </summary> 450 /// </summary>
460 public override PhysicsVector Size 451 public override Vector3 Size
461 { 452 {
462 get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); } 453 get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
463 set 454 set
464 { 455 {
465 if (PhysicsVector.isFinite(value)) 456 if (value.IsFinite())
466 { 457 {
467 m_pidControllerActive = true; 458 m_pidControllerActive = true;
468 459
469 PhysicsVector SetSize = value; 460 Vector3 SetSize = value;
470 m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f; 461 m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f;
471 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); 462 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
472 463
473 Velocity = new PhysicsVector(0f, 0f, 0f); 464 Velocity = Vector3.Zero;
474 465
475 _parent_scene.AddPhysicsActorTaint(this); 466 _parent_scene.AddPhysicsActorTaint(this);
476 } 467 }
@@ -481,7 +472,7 @@ namespace OpenSim.Region.Physics.OdePlugin
481 } 472 }
482 } 473 }
483 474
484 private void AlignAvatarTiltWithCurrentDirectionOfMovement(PhysicsVector movementVector) 475 private void AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3 movementVector)
485 { 476 {
486 movementVector.Z = 0f; 477 movementVector.Z = 0f;
487 float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y)); 478 float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y));
@@ -643,7 +634,7 @@ namespace OpenSim.Region.Physics.OdePlugin
643 // (with -0..0 motor stops) falls into the terrain for reasons yet 634 // (with -0..0 motor stops) falls into the terrain for reasons yet
644 // to be comprehended in their entirety. 635 // to be comprehended in their entirety.
645 #endregion 636 #endregion
646 AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(0,0,0)); 637 AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3.Zero);
647 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f); 638 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f);
648 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f); 639 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f);
649 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f); 640 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f);
@@ -688,7 +679,7 @@ namespace OpenSim.Region.Physics.OdePlugin
688 679
689 } 680 }
690 681
691 public override void LockAngularMotion(PhysicsVector axis) 682 public override void LockAngularMotion(Vector3 axis)
692 { 683 {
693 684
694 } 685 }
@@ -716,9 +707,9 @@ namespace OpenSim.Region.Physics.OdePlugin
716// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); 707// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
717// } 708// }
718 709
719 public override PhysicsVector Force 710 public override Vector3 Force
720 { 711 {
721 get { return new PhysicsVector(_target_velocity.X, _target_velocity.Y, _target_velocity.Z); } 712 get { return _target_velocity; }
722 set { return; } 713 set { return; }
723 } 714 }
724 715
@@ -733,7 +724,7 @@ namespace OpenSim.Region.Physics.OdePlugin
733 724
734 } 725 }
735 726
736 public override void VehicleVectorParam(int param, PhysicsVector value) 727 public override void VehicleVectorParam(int param, Vector3 value)
737 { 728 {
738 729
739 } 730 }
@@ -748,14 +739,14 @@ namespace OpenSim.Region.Physics.OdePlugin
748 739
749 } 740 }
750 741
751 public override PhysicsVector CenterOfMass 742 public override Vector3 CenterOfMass
752 { 743 {
753 get { return PhysicsVector.Zero; } 744 get { return Vector3.Zero; }
754 } 745 }
755 746
756 public override PhysicsVector GeometricCenter 747 public override Vector3 GeometricCenter
757 { 748 {
758 get { return PhysicsVector.Zero; } 749 get { return Vector3.Zero; }
759 } 750 }
760 751
761 public override PrimitiveBaseShape Shape 752 public override PrimitiveBaseShape Shape
@@ -763,18 +754,18 @@ namespace OpenSim.Region.Physics.OdePlugin
763 set { return; } 754 set { return; }
764 } 755 }
765 756
766 public override PhysicsVector Velocity 757 public override Vector3 Velocity
767 { 758 {
768 get { 759 get {
769 // There's a problem with PhysicsVector.Zero! Don't Use it Here! 760 // There's a problem with Vector3.Zero! Don't Use it Here!
770 if (_zeroFlag) 761 if (_zeroFlag)
771 return new PhysicsVector(0f, 0f, 0f); 762 return Vector3.Zero;
772 m_lastUpdateSent = false; 763 m_lastUpdateSent = false;
773 return _velocity; 764 return _velocity;
774 } 765 }
775 set 766 set
776 { 767 {
777 if (PhysicsVector.isFinite(value)) 768 if (value.IsFinite())
778 { 769 {
779 m_pidControllerActive = true; 770 m_pidControllerActive = true;
780 _target_velocity = value; 771 _target_velocity = value;
@@ -786,9 +777,9 @@ namespace OpenSim.Region.Physics.OdePlugin
786 } 777 }
787 } 778 }
788 779
789 public override PhysicsVector Torque 780 public override Vector3 Torque
790 { 781 {
791 get { return PhysicsVector.Zero; } 782 get { return Vector3.Zero; }
792 set { return; } 783 set { return; }
793 } 784 }
794 785
@@ -814,12 +805,12 @@ namespace OpenSim.Region.Physics.OdePlugin
814 } 805 }
815 } 806 }
816 807
817 public override PhysicsVector Acceleration 808 public override Vector3 Acceleration
818 { 809 {
819 get { return _acceleration; } 810 get { return _acceleration; }
820 } 811 }
821 812
822 public void SetAcceleration(PhysicsVector accel) 813 public void SetAcceleration(Vector3 accel)
823 { 814 {
824 m_pidControllerActive = true; 815 m_pidControllerActive = true;
825 _acceleration = accel; 816 _acceleration = accel;
@@ -830,9 +821,9 @@ namespace OpenSim.Region.Physics.OdePlugin
830 /// The PID controller takes this target velocity and tries to make it a reality 821 /// The PID controller takes this target velocity and tries to make it a reality
831 /// </summary> 822 /// </summary>
832 /// <param name="force"></param> 823 /// <param name="force"></param>
833 public override void AddForce(PhysicsVector force, bool pushforce) 824 public override void AddForce(Vector3 force, bool pushforce)
834 { 825 {
835 if (PhysicsVector.isFinite(force)) 826 if (force.IsFinite())
836 { 827 {
837 if (pushforce) 828 if (pushforce)
838 { 829 {
@@ -861,7 +852,7 @@ namespace OpenSim.Region.Physics.OdePlugin
861 //m_lastUpdateSent = false; 852 //m_lastUpdateSent = false;
862 } 853 }
863 854
864 public override void AddAngularForce(PhysicsVector force, bool pushforce) 855 public override void AddAngularForce(Vector3 force, bool pushforce)
865 { 856 {
866 857
867 } 858 }
@@ -870,7 +861,7 @@ namespace OpenSim.Region.Physics.OdePlugin
870 /// After all of the forces add up with 'add force' we apply them with doForce 861 /// After all of the forces add up with 'add force' we apply them with doForce
871 /// </summary> 862 /// </summary>
872 /// <param name="force"></param> 863 /// <param name="force"></param>
873 public void doForce(PhysicsVector force) 864 public void doForce(Vector3 force)
874 { 865 {
875 if (!collidelock) 866 if (!collidelock)
876 { 867 {
@@ -881,7 +872,7 @@ namespace OpenSim.Region.Physics.OdePlugin
881 } 872 }
882 } 873 }
883 874
884 public override void SetMomentum(PhysicsVector momentum) 875 public override void SetMomentum(Vector3 momentum)
885 { 876 {
886 } 877 }
887 878
@@ -908,9 +899,9 @@ namespace OpenSim.Region.Physics.OdePlugin
908 //PidStatus = true; 899 //PidStatus = true;
909 900
910 d.Vector3 localpos = d.BodyGetPosition(Body); 901 d.Vector3 localpos = d.BodyGetPosition(Body);
911 PhysicsVector localPos = new PhysicsVector(localpos.X, localpos.Y, localpos.Z); 902 Vector3 localPos = new Vector3(localpos.X, localpos.Y, localpos.Z);
912 903
913 if (!PhysicsVector.isFinite(localPos)) 904 if (!localPos.IsFinite())
914 { 905 {
915 906
916 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); 907 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
@@ -946,7 +937,7 @@ namespace OpenSim.Region.Physics.OdePlugin
946 return; 937 return;
947 } 938 }
948 939
949 PhysicsVector vec = new PhysicsVector(); 940 Vector3 vec = Vector3.Zero;
950 d.Vector3 vel = d.BodyGetLinearVel(Body); 941 d.Vector3 vel = d.BodyGetLinearVel(Body);
951 942
952 float movementdivisor = 1f; 943 float movementdivisor = 1f;
@@ -1059,12 +1050,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1059 } 1050 }
1060 // end add Kitto Flora 1051 // end add Kitto Flora
1061 } 1052 }
1062 if (PhysicsVector.isFinite(vec)) 1053 if (vec.IsFinite())
1063 { 1054 {
1064 doForce(vec); 1055 doForce(vec);
1065 if (!_zeroFlag) 1056 if (!_zeroFlag)
1066 { 1057 {
1067 AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(vec.X, vec.Y, vec.Z)); 1058 AlignAvatarTiltWithCurrentDirectionOfMovement(vec);
1068 } 1059 }
1069 } 1060 }
1070 else 1061 else
@@ -1197,7 +1188,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1197 { 1188 {
1198 } 1189 }
1199 1190
1200 public override PhysicsVector PIDTarget { set { return; } } 1191 public override Vector3 PIDTarget { set { return; } }
1201 public override bool PIDActive { set { return; } } 1192 public override bool PIDActive { set { return; } }
1202 public override float PIDTau { set { return; } } 1193 public override float PIDTau { set { return; } }
1203 1194
@@ -1311,7 +1302,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1311 d.GeomDestroy(Shell); 1302 d.GeomDestroy(Shell);
1312 AvatarGeomAndBodyCreation(_position.X, _position.Y, 1303 AvatarGeomAndBodyCreation(_position.X, _position.Y,
1313 _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); 1304 _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
1314 Velocity = new PhysicsVector(0f, 0f, 0f); 1305 Velocity = Vector3.Zero;
1315 1306
1316 _parent_scene.geom_name_map[Shell] = m_name; 1307 _parent_scene.geom_name_map[Shell] = m_name;
1317 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; 1308 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
@@ -1325,7 +1316,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1325 } 1316 }
1326 } 1317 }
1327 1318
1328 if (!m_taintPosition.IsIdentical(_position, 0.05f)) 1319 if (!m_taintPosition.ApproxEquals(_position, 0.05f))
1329 { 1320 {
1330 if (Body != IntPtr.Zero) 1321 if (Body != IntPtr.Zero)
1331 { 1322 {
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
index 019c78b..4a802cd 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
@@ -232,7 +232,7 @@ namespace OpenSim.Region.Physics.OdePlugin
232 232
233 }//end ProcessFloatVehicleParam 233 }//end ProcessFloatVehicleParam
234 234
235 internal void ProcessVectorVehicleParam(Vehicle pParam, PhysicsVector pValue) 235 internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue)
236 { 236 {
237 switch (pParam) 237 switch (pParam)
238 { 238 {
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 09c8582..5ff9d32 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -57,44 +57,43 @@ namespace OpenSim.Region.Physics.OdePlugin
57 { 57 {
58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59 59
60 private PhysicsVector _position; 60 private Vector3 _position;
61 private PhysicsVector _velocity; 61 private Vector3 _velocity;
62 private PhysicsVector _torque = new PhysicsVector(0,0,0); 62 private Vector3 _torque;
63 private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); 63 private Vector3 m_lastVelocity;
64 private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); 64 private Vector3 m_lastposition;
65 private Quaternion m_lastorientation = new Quaternion(); 65 private Quaternion m_lastorientation = new Quaternion();
66 private PhysicsVector m_rotationalVelocity; 66 private Vector3 m_rotationalVelocity;
67 private PhysicsVector _size; 67 private Vector3 _size;
68 private PhysicsVector _acceleration; 68 private Vector3 _acceleration;
69 // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); 69 // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f);
70 private Quaternion _orientation; 70 private Quaternion _orientation;
71 private PhysicsVector m_taintposition; 71 private Vector3 m_taintposition;
72 private PhysicsVector m_taintsize; 72 private Vector3 m_taintsize;
73 private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0); 73 private Vector3 m_taintVelocity;
74 private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0); 74 private Vector3 m_taintTorque;
75 private Quaternion m_taintrot; 75 private Quaternion m_taintrot;
76 private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f); 76 private Vector3 m_angularlock = Vector3.One;
77 private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f); 77 private Vector3 m_taintAngularLock = Vector3.One;
78 private IntPtr Amotor = IntPtr.Zero; 78 private IntPtr Amotor = IntPtr.Zero;
79 79
80 private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0); 80 private Vector3 m_PIDTarget;
81 // private PhysicsVector m_taintPIDTarget = new PhysicsVector(0, 0, 0); 81 private float m_PIDTau;
82 private float m_PIDTau = 0f;
83 private float PID_D = 35f; 82 private float PID_D = 35f;
84 private float PID_G = 25f; 83 private float PID_G = 25f;
85 private bool m_usePID = false; 84 private bool m_usePID;
86 85
87 // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), 86 // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau),
88 // and are for non-VEHICLES only. 87 // and are for non-VEHICLES only.
89 88
90 private float m_PIDHoverHeight = 0f; 89 private float m_PIDHoverHeight;
91 private float m_PIDHoverTau = 0f; 90 private float m_PIDHoverTau;
92 private bool m_useHoverPID = false; 91 private bool m_useHoverPID;
93 private PIDHoverType m_PIDHoverType = PIDHoverType.Ground; 92 private PIDHoverType m_PIDHoverType = PIDHoverType.Ground;
94 private float m_targetHoverHeight = 0f; 93 private float m_targetHoverHeight;
95 private float m_groundHeight = 0f; 94 private float m_groundHeight;
96 private float m_waterHeight = 0f; 95 private float m_waterHeight;
97 private float m_buoyancy = 0f; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. 96 private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
98 97
99 // private float m_tensor = 5f; 98 // private float m_tensor = 5f;
100 private int body_autodisable_frames = 20; 99 private int body_autodisable_frames = 20;
@@ -105,11 +104,11 @@ namespace OpenSim.Region.Physics.OdePlugin
105 | CollisionCategories.Body 104 | CollisionCategories.Body
106 | CollisionCategories.Character 105 | CollisionCategories.Character
107 ); 106 );
108 private bool m_taintshape = false; 107 private bool m_taintshape;
109 private bool m_taintPhysics = false; 108 private bool m_taintPhysics;
110 private bool m_collidesLand = true; 109 private bool m_collidesLand = true;
111 private bool m_collidesWater = false; 110 private bool m_collidesWater;
112 public bool m_returnCollisions = false; 111 public bool m_returnCollisions;
113 112
114 // Default we're a Geometry 113 // Default we're a Geometry
115 private CollisionCategories m_collisionCategories = (CollisionCategories.Geom); 114 private CollisionCategories m_collisionCategories = (CollisionCategories.Geom);
@@ -117,85 +116,83 @@ namespace OpenSim.Region.Physics.OdePlugin
117 // Default, Collide with Other Geometries, spaces and Bodies 116 // Default, Collide with Other Geometries, spaces and Bodies
118 private CollisionCategories m_collisionFlags = m_default_collisionFlags; 117 private CollisionCategories m_collisionFlags = m_default_collisionFlags;
119 118
120 public bool m_taintremove = false; 119 public bool m_taintremove;
121 public bool m_taintdisable = false; 120 public bool m_taintdisable;
122 public bool m_disabled = false; 121 public bool m_disabled;
123 public bool m_taintadd = false; 122 public bool m_taintadd;
124 public bool m_taintselected = false; 123 public bool m_taintselected;
125 public bool m_taintCollidesWater = false; 124 public bool m_taintCollidesWater;
126 125
127 public uint m_localID = 0; 126 public uint m_localID;
128 127
129 //public GCHandle gc; 128 //public GCHandle gc;
130 private CollisionLocker ode; 129 private CollisionLocker ode;
131 130
132 private bool m_taintforce = false; 131 private bool m_taintforce = false;
133 private bool m_taintaddangularforce = false; 132 private bool m_taintaddangularforce = false;
134 private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f); 133 private Vector3 m_force;
135 private List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); 134 private List<Vector3> m_forcelist = new List<Vector3>();
136 private List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>(); 135 private List<Vector3> m_angularforcelist = new List<Vector3>();
137 136
138 private IMesh _mesh; 137 private IMesh _mesh;
139 private PrimitiveBaseShape _pbs; 138 private PrimitiveBaseShape _pbs;
140 private OdeScene _parent_scene; 139 private OdeScene _parent_scene;
141 public IntPtr m_targetSpace = (IntPtr) 0; 140 public IntPtr m_targetSpace = IntPtr.Zero;
142 public IntPtr prim_geom; 141 public IntPtr prim_geom;
143 public IntPtr prev_geom; 142 public IntPtr prev_geom;
144 public IntPtr _triMeshData; 143 public IntPtr _triMeshData;
145 144
146 private IntPtr _linkJointGroup = (IntPtr)0; 145 private IntPtr _linkJointGroup = IntPtr.Zero;
147 private PhysicsActor _parent = null; 146 private PhysicsActor _parent;
148 private PhysicsActor m_taintparent = null; 147 private PhysicsActor m_taintparent;
149 148
150 private List<OdePrim> childrenPrim = new List<OdePrim>(); 149 private List<OdePrim> childrenPrim = new List<OdePrim>();
151 150
152 private bool iscolliding = false; 151 private bool iscolliding;
153 private bool m_isphysical = false; 152 private bool m_isphysical;
154 private bool m_isSelected = false; 153 private bool m_isSelected;
155 154
156 internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively 155 internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively
157 156
158 private bool m_throttleUpdates = false; 157 private bool m_throttleUpdates;
159 private int throttleCounter = 0; 158 private int throttleCounter;
160 public int m_interpenetrationcount = 0; 159 public int m_interpenetrationcount;
161 public float m_collisionscore = 0; 160 public float m_collisionscore;
162 public int m_roundsUnderMotionThreshold = 0; 161 public int m_roundsUnderMotionThreshold;
163 private int m_crossingfailures = 0; 162 private int m_crossingfailures;
164 163
165 public bool outofBounds = false; 164 public bool outofBounds;
166 private float m_density = 10.000006836f; // Aluminum g/cm3; 165 private float m_density = 10.000006836f; // Aluminum g/cm3;
167 166
168 public bool _zeroFlag = false; 167 public bool _zeroFlag;
169 private bool m_lastUpdateSent = false; 168 private bool m_lastUpdateSent;
170 169
171 public IntPtr Body = (IntPtr) 0; 170 public IntPtr Body = IntPtr.Zero;
172 public String m_primName; 171 public String m_primName;
173// private String m_primName; 172 private Vector3 _target_velocity;
174 private PhysicsVector _target_velocity;
175 public d.Mass pMass; 173 public d.Mass pMass;
176 174
177 public int m_eventsubscription = 0; 175 public int m_eventsubscription;
178 private CollisionEventUpdate CollisionEventsThisFrame = null; 176 private CollisionEventUpdate CollisionEventsThisFrame;
179 177
180 private IntPtr m_linkJoint = (IntPtr)0; 178 private IntPtr m_linkJoint = IntPtr.Zero;
181 179
182 public volatile bool childPrim = false; 180 public volatile bool childPrim;
183 181
184 private ODEDynamics m_vehicle; 182 private ODEDynamics m_vehicle;
185 183
186 internal int m_material = (int)Material.Wood; 184 internal int m_material = (int)Material.Wood;
187 185
188 public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, 186 public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
189 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) 187 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
190 { 188 {
191 _target_velocity = new PhysicsVector(0, 0, 0);
192 m_vehicle = new ODEDynamics(); 189 m_vehicle = new ODEDynamics();
193 //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned); 190 //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);
194 ode = dode; 191 ode = dode;
195 _velocity = new PhysicsVector(); 192 if (!pos.IsFinite())
196 if (!PhysicsVector.isFinite(pos))
197 { 193 {
198 pos = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), parent_scene.GetTerrainHeightAtXY(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f)) + 0.5f); 194 pos = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f),
195 parent_scene.GetTerrainHeightAtXY(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f)) + 0.5f);
199 m_log.Warn("[PHYSICS]: Got nonFinite Object create Position"); 196 m_log.Warn("[PHYSICS]: Got nonFinite Object create Position");
200 } 197 }
201 _position = pos; 198 _position = pos;
@@ -210,9 +207,9 @@ namespace OpenSim.Region.Physics.OdePlugin
210 prim_geom = IntPtr.Zero; 207 prim_geom = IntPtr.Zero;
211 prev_geom = IntPtr.Zero; 208 prev_geom = IntPtr.Zero;
212 209
213 if (!PhysicsVector.isFinite(pos)) 210 if (!pos.IsFinite())
214 { 211 {
215 size = new PhysicsVector(0.5f, 0.5f, 0.5f); 212 size = new Vector3(0.5f, 0.5f, 0.5f);
216 m_log.Warn("[PHYSICS]: Got nonFinite Object create Size"); 213 m_log.Warn("[PHYSICS]: Got nonFinite Object create Size");
217 } 214 }
218 215
@@ -222,8 +219,6 @@ namespace OpenSim.Region.Physics.OdePlugin
222 219
223 _size = size; 220 _size = size;
224 m_taintsize = _size; 221 m_taintsize = _size;
225 _acceleration = new PhysicsVector();
226 m_rotationalVelocity = PhysicsVector.Zero;
227 222
228 if (!QuaternionIsFinite(rotation)) 223 if (!QuaternionIsFinite(rotation))
229 { 224 {
@@ -388,7 +383,7 @@ namespace OpenSim.Region.Physics.OdePlugin
388 m_disabled = false; 383 m_disabled = false;
389 384
390 // The body doesn't already have a finite rotation mode set here 385 // The body doesn't already have a finite rotation mode set here
391 if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null) 386 if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0.0f)) && _parent == null)
392 { 387 {
393 createAMotor(m_angularlock); 388 createAMotor(m_angularlock);
394 } 389 }
@@ -882,7 +877,7 @@ namespace OpenSim.Region.Physics.OdePlugin
882 877
883 if (prim_geom != IntPtr.Zero) 878 if (prim_geom != IntPtr.Zero)
884 { 879 {
885 if (!_position.IsIdentical(m_taintposition,0f)) 880 if (!_position.ApproxEquals(m_taintposition, 0f))
886 changemove(timestep); 881 changemove(timestep);
887 882
888 if (m_taintrot != _orientation) 883 if (m_taintrot != _orientation)
@@ -907,7 +902,7 @@ namespace OpenSim.Region.Physics.OdePlugin
907 changePhysicsStatus(timestep); 902 changePhysicsStatus(timestep);
908 // 903 //
909 904
910 if (!_size.IsIdentical(m_taintsize,0)) 905 if (!_size.ApproxEquals(m_taintsize,0f))
911 changesize(timestep); 906 changesize(timestep);
912 // 907 //
913 908
@@ -921,7 +916,7 @@ namespace OpenSim.Region.Physics.OdePlugin
921 if (m_taintaddangularforce) 916 if (m_taintaddangularforce)
922 changeAddAngularForce(timestep); 917 changeAddAngularForce(timestep);
923 918
924 if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f)) 919 if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f))
925 changeSetTorque(timestep); 920 changeSetTorque(timestep);
926 921
927 if (m_taintdisable) 922 if (m_taintdisable)
@@ -930,7 +925,7 @@ namespace OpenSim.Region.Physics.OdePlugin
930 if (m_taintselected != m_isSelected) 925 if (m_taintselected != m_isSelected)
931 changeSelectedStatus(timestep); 926 changeSelectedStatus(timestep);
932 927
933 if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f)) 928 if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f))
934 changevelocity(timestep); 929 changevelocity(timestep);
935 930
936 if (m_taintparent != _parent) 931 if (m_taintparent != _parent)
@@ -939,7 +934,7 @@ namespace OpenSim.Region.Physics.OdePlugin
939 if (m_taintCollidesWater != m_collidesWater) 934 if (m_taintCollidesWater != m_collidesWater)
940 changefloatonwater(timestep); 935 changefloatonwater(timestep);
941 936
942 if (!m_angularlock.IsIdentical(m_taintAngularLock,0)) 937 if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f))
943 changeAngularLock(timestep); 938 changeAngularLock(timestep);
944 939
945 } 940 }
@@ -959,7 +954,7 @@ namespace OpenSim.Region.Physics.OdePlugin
959 //If we have a parent then we're not authorative here 954 //If we have a parent then we're not authorative here
960 if (_parent == null) 955 if (_parent == null)
961 { 956 {
962 if (!m_taintAngularLock.IsIdentical(new PhysicsVector(1f,1f,1f), 0)) 957 if (!m_taintAngularLock.ApproxEquals(Vector3.One, 0f))
963 { 958 {
964 //d.BodySetFiniteRotationMode(Body, 0); 959 //d.BodySetFiniteRotationMode(Body, 0);
965 //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z); 960 //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z);
@@ -976,7 +971,7 @@ namespace OpenSim.Region.Physics.OdePlugin
976 } 971 }
977 } 972 }
978 // Store this for later in case we get turned into a separate body 973 // Store this for later in case we get turned into a separate body
979 m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z); 974 m_angularlock = m_taintAngularLock;
980 975
981 } 976 }
982 977
@@ -1120,7 +1115,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1120 prm.m_disabled = false; 1115 prm.m_disabled = false;
1121 1116
1122 // The body doesn't already have a finite rotation mode set here 1117 // The body doesn't already have a finite rotation mode set here
1123 if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null) 1118 if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
1124 { 1119 {
1125 prm.createAMotor(m_angularlock); 1120 prm.createAMotor(m_angularlock);
1126 } 1121 }
@@ -1163,7 +1158,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1163 m_disabled = false; 1158 m_disabled = false;
1164 1159
1165 // The body doesn't already have a finite rotation mode set here 1160 // The body doesn't already have a finite rotation mode set here
1166 if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null) 1161 if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
1167 { 1162 {
1168 createAMotor(m_angularlock); 1163 createAMotor(m_angularlock);
1169 } 1164 }
@@ -1347,7 +1342,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1347 m_taintshape = false; 1342 m_taintshape = false;
1348 m_taintforce = false; 1343 m_taintforce = false;
1349 m_taintdisable = false; 1344 m_taintdisable = false;
1350 m_taintVelocity = PhysicsVector.Zero; 1345 m_taintVelocity = Vector3.Zero;
1351 } 1346 }
1352 1347
1353 public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh) 1348 public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh)
@@ -1576,7 +1571,7 @@ Console.WriteLine(" JointCreateFixed");
1576//Console.WriteLine("Move " + m_primName); 1571//Console.WriteLine("Move " + m_primName);
1577 if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 1572 if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
1578 // NON-'VEHICLES' are dealt with here 1573 // NON-'VEHICLES' are dealt with here
1579 if (d.BodyIsEnabled(Body) && !m_angularlock.IsIdentical(PhysicsVector.Zero, 0.003f)) 1574 if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f))
1580 { 1575 {
1581 d.Vector3 avel2 = d.BodyGetAngularVel(Body); 1576 d.Vector3 avel2 = d.BodyGetAngularVel(Body);
1582 if (m_angularlock.X == 1) 1577 if (m_angularlock.X == 1)
@@ -1633,7 +1628,7 @@ Console.WriteLine(" JointCreateFixed");
1633 1628
1634 d.Vector3 pos = d.BodyGetPosition(Body); 1629 d.Vector3 pos = d.BodyGetPosition(Body);
1635 _target_velocity = 1630 _target_velocity =
1636 new PhysicsVector( 1631 new Vector3(
1637 (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep), 1632 (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep),
1638 (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep), 1633 (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep),
1639 (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep) 1634 (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep)
@@ -1641,7 +1636,7 @@ Console.WriteLine(" JointCreateFixed");
1641 1636
1642 // if velocity is zero, use position control; otherwise, velocity control 1637 // if velocity is zero, use position control; otherwise, velocity control
1643 1638
1644 if (_target_velocity.IsIdentical(PhysicsVector.Zero,0.1f)) 1639 if (_target_velocity.ApproxEquals(Vector3.Zero,0.1f))
1645 { 1640 {
1646 // keep track of where we stopped. No more slippin' & slidin' 1641 // keep track of where we stopped. No more slippin' & slidin'
1647 1642
@@ -1726,13 +1721,13 @@ Console.WriteLine(" JointCreateFixed");
1726 1721
1727 1722
1728 _target_velocity = 1723 _target_velocity =
1729 new PhysicsVector(0.0f, 0.0f, 1724 new Vector3(0.0f, 0.0f,
1730 (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep) 1725 (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep)
1731 ); 1726 );
1732 1727
1733 // if velocity is zero, use position control; otherwise, velocity control 1728 // if velocity is zero, use position control; otherwise, velocity control
1734 1729
1735 if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f)) 1730 if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f))
1736 { 1731 {
1737 // keep track of where we stopped. No more slippin' & slidin' 1732 // keep track of where we stopped. No more slippin' & slidin'
1738 1733
@@ -1821,7 +1816,7 @@ Console.WriteLine(" JointCreateFixed");
1821 d.BodySetQuaternion(Body, ref myrot); 1816 d.BodySetQuaternion(Body, ref myrot);
1822 if (m_isphysical) 1817 if (m_isphysical)
1823 { 1818 {
1824 if (!m_angularlock.IsIdentical(new PhysicsVector(1, 1, 1), 0)) 1819 if (!m_angularlock.ApproxEquals(Vector3.One, 0f))
1825 createAMotor(m_angularlock); 1820 createAMotor(m_angularlock);
1826 } 1821 }
1827 } 1822 }
@@ -2130,7 +2125,7 @@ Console.WriteLine(" JointCreateFixed");
2130 //m_log.Info("[PHYSICS]: dequeing forcelist"); 2125 //m_log.Info("[PHYSICS]: dequeing forcelist");
2131 if (IsPhysical) 2126 if (IsPhysical)
2132 { 2127 {
2133 PhysicsVector iforce = new PhysicsVector(); 2128 Vector3 iforce = Vector3.Zero;
2134 for (int i = 0; i < m_forcelist.Count; i++) 2129 for (int i = 0; i < m_forcelist.Count; i++)
2135 { 2130 {
2136 iforce = iforce + (m_forcelist[i] * 100); 2131 iforce = iforce + (m_forcelist[i] * 100);
@@ -2160,8 +2155,8 @@ Console.WriteLine(" JointCreateFixed");
2160 d.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z); 2155 d.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z);
2161 } 2156 }
2162 } 2157 }
2163 2158
2164 m_taintTorque = new PhysicsVector(0, 0, 0); 2159 m_taintTorque = Vector3.Zero;
2165 } 2160 }
2166 2161
2167 public void changeAddAngularForce(float timestamp) 2162 public void changeAddAngularForce(float timestamp)
@@ -2173,7 +2168,7 @@ Console.WriteLine(" JointCreateFixed");
2173 //m_log.Info("[PHYSICS]: dequeing forcelist"); 2168 //m_log.Info("[PHYSICS]: dequeing forcelist");
2174 if (IsPhysical) 2169 if (IsPhysical)
2175 { 2170 {
2176 PhysicsVector iforce = new PhysicsVector(); 2171 Vector3 iforce = Vector3.Zero;
2177 for (int i = 0; i < m_angularforcelist.Count; i++) 2172 for (int i = 0; i < m_angularforcelist.Count; i++)
2178 { 2173 {
2179 iforce = iforce + (m_angularforcelist[i] * 100); 2174 iforce = iforce + (m_angularforcelist[i] * 100);
@@ -2207,7 +2202,7 @@ Console.WriteLine(" JointCreateFixed");
2207 2202
2208 //resetCollisionAccounting(); 2203 //resetCollisionAccounting();
2209 } 2204 }
2210 m_taintVelocity = PhysicsVector.Zero; 2205 m_taintVelocity = Vector3.Zero;
2211 } 2206 }
2212 2207
2213 public override bool IsPhysical 2208 public override bool IsPhysical
@@ -2216,7 +2211,7 @@ Console.WriteLine(" JointCreateFixed");
2216 set { 2211 set {
2217 m_isphysical = value; 2212 m_isphysical = value;
2218 if (!m_isphysical) // Zero the remembered last velocity 2213 if (!m_isphysical) // Zero the remembered last velocity
2219 m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); 2214 m_lastVelocity = Vector3.Zero;
2220 } 2215 }
2221 } 2216 }
2222 2217
@@ -2261,7 +2256,7 @@ Console.WriteLine(" JointCreateFixed");
2261 get { return _zeroFlag; } 2256 get { return _zeroFlag; }
2262 } 2257 }
2263 2258
2264 public override PhysicsVector Position 2259 public override Vector3 Position
2265 { 2260 {
2266 get { return _position; } 2261 get { return _position; }
2267 2262
@@ -2270,12 +2265,12 @@ Console.WriteLine(" JointCreateFixed");
2270 } 2265 }
2271 } 2266 }
2272 2267
2273 public override PhysicsVector Size 2268 public override Vector3 Size
2274 { 2269 {
2275 get { return _size; } 2270 get { return _size; }
2276 set 2271 set
2277 { 2272 {
2278 if (PhysicsVector.isFinite(value)) 2273 if (value.IsFinite())
2279 { 2274 {
2280 _size = value; 2275 _size = value;
2281 } 2276 }
@@ -2291,13 +2286,13 @@ Console.WriteLine(" JointCreateFixed");
2291 get { return CalculateMass(); } 2286 get { return CalculateMass(); }
2292 } 2287 }
2293 2288
2294 public override PhysicsVector Force 2289 public override Vector3 Force
2295 { 2290 {
2296 //get { return PhysicsVector.Zero; } 2291 //get { return Vector3.Zero; }
2297 get { return m_force; } 2292 get { return m_force; }
2298 set 2293 set
2299 { 2294 {
2300 if (PhysicsVector.isFinite(value)) 2295 if (value.IsFinite())
2301 { 2296 {
2302 m_force = value; 2297 m_force = value;
2303 } 2298 }
@@ -2319,7 +2314,7 @@ Console.WriteLine(" JointCreateFixed");
2319 m_vehicle.ProcessFloatVehicleParam((Vehicle) param, value); 2314 m_vehicle.ProcessFloatVehicleParam((Vehicle) param, value);
2320 } 2315 }
2321 2316
2322 public override void VehicleVectorParam(int param, PhysicsVector value) 2317 public override void VehicleVectorParam(int param, Vector3 value)
2323 { 2318 {
2324 m_vehicle.ProcessVectorVehicleParam((Vehicle) param, value); 2319 m_vehicle.ProcessVectorVehicleParam((Vehicle) param, value);
2325 } 2320 }
@@ -2337,14 +2332,14 @@ Console.WriteLine(" JointCreateFixed");
2337 } 2332 }
2338 } 2333 }
2339 2334
2340 public override PhysicsVector CenterOfMass 2335 public override Vector3 CenterOfMass
2341 { 2336 {
2342 get { return PhysicsVector.Zero; } 2337 get { return Vector3.Zero; }
2343 } 2338 }
2344 2339
2345 public override PhysicsVector GeometricCenter 2340 public override Vector3 GeometricCenter
2346 { 2341 {
2347 get { return PhysicsVector.Zero; } 2342 get { return Vector3.Zero; }
2348 } 2343 }
2349 2344
2350 public override PrimitiveBaseShape Shape 2345 public override PrimitiveBaseShape Shape
@@ -2356,13 +2351,13 @@ Console.WriteLine(" JointCreateFixed");
2356 } 2351 }
2357 } 2352 }
2358 2353
2359 public override PhysicsVector Velocity 2354 public override Vector3 Velocity
2360 { 2355 {
2361 get 2356 get
2362 { 2357 {
2363 // Averate previous velocity with the new one so 2358 // Averate previous velocity with the new one so
2364 // client object interpolation works a 'little' better 2359 // client object interpolation works a 'little' better
2365 PhysicsVector returnVelocity = new PhysicsVector(); 2360 Vector3 returnVelocity = Vector3.Zero;
2366 returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2; 2361 returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2;
2367 returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2; 2362 returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2;
2368 returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2; 2363 returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2;
@@ -2370,7 +2365,7 @@ Console.WriteLine(" JointCreateFixed");
2370 } 2365 }
2371 set 2366 set
2372 { 2367 {
2373 if (PhysicsVector.isFinite(value)) 2368 if (value.IsFinite())
2374 { 2369 {
2375 _velocity = value; 2370 _velocity = value;
2376 2371
@@ -2385,19 +2380,19 @@ Console.WriteLine(" JointCreateFixed");
2385 } 2380 }
2386 } 2381 }
2387 2382
2388 public override PhysicsVector Torque 2383 public override Vector3 Torque
2389 { 2384 {
2390 get 2385 get
2391 { 2386 {
2392 if (!m_isphysical || Body == IntPtr.Zero) 2387 if (!m_isphysical || Body == IntPtr.Zero)
2393 return new PhysicsVector(0,0,0); 2388 return Vector3.Zero;
2394 2389
2395 return _torque; 2390 return _torque;
2396 } 2391 }
2397 2392
2398 set 2393 set
2399 { 2394 {
2400 if (PhysicsVector.isFinite(value)) 2395 if (value.IsFinite())
2401 { 2396 {
2402 m_taintTorque = value; 2397 m_taintTorque = value;
2403 _parent_scene.AddPhysicsActorTaint(this); 2398 _parent_scene.AddPhysicsActorTaint(this);
@@ -2449,20 +2444,20 @@ Console.WriteLine(" JointCreateFixed");
2449 return true; 2444 return true;
2450 } 2445 }
2451 2446
2452 public override PhysicsVector Acceleration 2447 public override Vector3 Acceleration
2453 { 2448 {
2454 get { return _acceleration; } 2449 get { return _acceleration; }
2455 } 2450 }
2456 2451
2457 2452
2458 public void SetAcceleration(PhysicsVector accel) 2453 public void SetAcceleration(Vector3 accel)
2459 { 2454 {
2460 _acceleration = accel; 2455 _acceleration = accel;
2461 } 2456 }
2462 2457
2463 public override void AddForce(PhysicsVector force, bool pushforce) 2458 public override void AddForce(Vector3 force, bool pushforce)
2464 { 2459 {
2465 if (PhysicsVector.isFinite(force)) 2460 if (force.IsFinite())
2466 { 2461 {
2467 m_forcelist.Add(force); 2462 m_forcelist.Add(force);
2468 m_taintforce = true; 2463 m_taintforce = true;
@@ -2474,9 +2469,9 @@ Console.WriteLine(" JointCreateFixed");
2474 //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); 2469 //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString());
2475 } 2470 }
2476 2471
2477 public override void AddAngularForce(PhysicsVector force, bool pushforce) 2472 public override void AddAngularForce(Vector3 force, bool pushforce)
2478 { 2473 {
2479 if (PhysicsVector.isFinite(force)) 2474 if (force.IsFinite())
2480 { 2475 {
2481 m_angularforcelist.Add(force); 2476 m_angularforcelist.Add(force);
2482 m_taintaddangularforce = true; 2477 m_taintaddangularforce = true;
@@ -2487,23 +2482,23 @@ Console.WriteLine(" JointCreateFixed");
2487 } 2482 }
2488 } 2483 }
2489 2484
2490 public override PhysicsVector RotationalVelocity 2485 public override Vector3 RotationalVelocity
2491 { 2486 {
2492 get 2487 get
2493 { 2488 {
2494 PhysicsVector pv = new PhysicsVector(0, 0, 0); 2489 Vector3 pv = Vector3.Zero;
2495 if (_zeroFlag) 2490 if (_zeroFlag)
2496 return pv; 2491 return pv;
2497 m_lastUpdateSent = false; 2492 m_lastUpdateSent = false;
2498 2493
2499 if (m_rotationalVelocity.IsIdentical(pv, 0.2f)) 2494 if (m_rotationalVelocity.ApproxEquals(pv, 0.2f))
2500 return pv; 2495 return pv;
2501 2496
2502 return m_rotationalVelocity; 2497 return m_rotationalVelocity;
2503 } 2498 }
2504 set 2499 set
2505 { 2500 {
2506 if (PhysicsVector.isFinite(value)) 2501 if (value.IsFinite())
2507 { 2502 {
2508 m_rotationalVelocity = value; 2503 m_rotationalVelocity = value;
2509 } 2504 }
@@ -2544,16 +2539,16 @@ Console.WriteLine(" JointCreateFixed");
2544 m_taintparent = null; 2539 m_taintparent = null;
2545 } 2540 }
2546 2541
2547 public override void LockAngularMotion(PhysicsVector axis) 2542 public override void LockAngularMotion(Vector3 axis)
2548 { 2543 {
2549 // reverse the zero/non zero values for ODE. 2544 // reverse the zero/non zero values for ODE.
2550 if (PhysicsVector.isFinite(axis)) 2545 if (axis.IsFinite())
2551 { 2546 {
2552 axis.X = (axis.X > 0) ? 1f : 0f; 2547 axis.X = (axis.X > 0) ? 1f : 0f;
2553 axis.Y = (axis.Y > 0) ? 1f : 0f; 2548 axis.Y = (axis.Y > 0) ? 1f : 0f;
2554 axis.Z = (axis.Z > 0) ? 1f : 0f; 2549 axis.Z = (axis.Z > 0) ? 1f : 0f;
2555 m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z); 2550 m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
2556 m_taintAngularLock = new PhysicsVector(axis.X, axis.Y, axis.Z); 2551 m_taintAngularLock = axis;
2557 } 2552 }
2558 else 2553 else
2559 { 2554 {
@@ -2566,7 +2561,7 @@ Console.WriteLine(" JointCreateFixed");
2566 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! 2561 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
2567 if (_parent == null) 2562 if (_parent == null)
2568 { 2563 {
2569 PhysicsVector pv = new PhysicsVector(0, 0, 0); 2564 Vector3 pv = Vector3.Zero;
2570 bool lastZeroFlag = _zeroFlag; 2565 bool lastZeroFlag = _zeroFlag;
2571 if (Body != (IntPtr)0) // FIXME -> or if it is a joint 2566 if (Body != (IntPtr)0) // FIXME -> or if it is a joint
2572 { 2567 {
@@ -2575,9 +2570,9 @@ Console.WriteLine(" JointCreateFixed");
2575 d.Vector3 vel = d.BodyGetLinearVel(Body); 2570 d.Vector3 vel = d.BodyGetLinearVel(Body);
2576 d.Vector3 rotvel = d.BodyGetAngularVel(Body); 2571 d.Vector3 rotvel = d.BodyGetAngularVel(Body);
2577 d.Vector3 torque = d.BodyGetTorque(Body); 2572 d.Vector3 torque = d.BodyGetTorque(Body);
2578 _torque.setValues(torque.X, torque.Y, torque.Z); 2573 _torque = new Vector3(torque.X, torque.Y, torque.Z);
2579 PhysicsVector l_position = new PhysicsVector(); 2574 Vector3 l_position = Vector3.Zero;
2580 Quaternion l_orientation = new Quaternion(); 2575 Quaternion l_orientation = Quaternion.Identity;
2581 2576
2582 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) 2577 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
2583 //if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } 2578 //if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); }
@@ -2712,16 +2707,16 @@ Console.WriteLine(" JointCreateFixed");
2712 _velocity.Z = vel.Z; 2707 _velocity.Z = vel.Z;
2713 2708
2714 _acceleration = ((_velocity - m_lastVelocity) / 0.1f); 2709 _acceleration = ((_velocity - m_lastVelocity) / 0.1f);
2715 _acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); 2710 _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f);
2716 //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); 2711 //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString());
2717 2712
2718 if (_velocity.IsIdentical(pv, 0.5f)) 2713 if (_velocity.ApproxEquals(pv, 0.5f))
2719 { 2714 {
2720 m_rotationalVelocity = pv; 2715 m_rotationalVelocity = pv;
2721 } 2716 }
2722 else 2717 else
2723 { 2718 {
2724 m_rotationalVelocity.setValues(rotvel.X, rotvel.Y, rotvel.Z); 2719 m_rotationalVelocity = new Vector3(rotvel.X, rotvel.Y, rotvel.Z);
2725 } 2720 }
2726 2721
2727 //m_log.Debug("ODE: " + m_rotationalVelocity.ToString()); 2722 //m_log.Debug("ODE: " + m_rotationalVelocity.ToString());
@@ -2769,15 +2764,15 @@ Console.WriteLine(" JointCreateFixed");
2769 } 2764 }
2770 } 2765 }
2771 2766
2772 public override void SetMomentum(PhysicsVector momentum) 2767 public override void SetMomentum(Vector3 momentum)
2773 { 2768 {
2774 } 2769 }
2775 2770
2776 public override PhysicsVector PIDTarget 2771 public override Vector3 PIDTarget
2777 { 2772 {
2778 set 2773 set
2779 { 2774 {
2780 if (PhysicsVector.isFinite(value)) 2775 if (value.IsFinite())
2781 { 2776 {
2782 m_PIDTarget = value; 2777 m_PIDTarget = value;
2783 } 2778 }
@@ -2793,7 +2788,7 @@ Console.WriteLine(" JointCreateFixed");
2793 public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } 2788 public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } }
2794 public override float PIDHoverTau { set { m_PIDHoverTau = value; } } 2789 public override float PIDHoverTau { set { m_PIDHoverTau = value; } }
2795 2790
2796 private void createAMotor(PhysicsVector axis) 2791 private void createAMotor(Vector3 axis)
2797 { 2792 {
2798 if (Body == IntPtr.Zero) 2793 if (Body == IntPtr.Zero)
2799 return; 2794 return;
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
684 /// </summary> 684 /// </summary>
685 /// <param name="pos"></param> 685 /// <param name="pos"></param>
686 /// <returns>Returns which split up space the given position is in.</returns> 686 /// <returns>Returns which split up space the given position is in.</returns>
687 public string whichspaceamIin(PhysicsVector pos) 687 public string whichspaceamIin(Vector3 pos)
688 { 688 {
689 return calculateSpaceForGeom(pos).ToString(); 689 return calculateSpaceForGeom(pos).ToString();
690 } 690 }
@@ -963,7 +963,7 @@ namespace OpenSim.Region.Physics.OdePlugin
963 963
964 //p2.CollidingObj = true; 964 //p2.CollidingObj = true;
965 contacts[i].depth = 0.00000003f; 965 contacts[i].depth = 0.00000003f;
966 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f); 966 p2.Velocity = p2.Velocity + new Vector3(0f, 0f, 0.5f);
967 contacts[i].pos = 967 contacts[i].pos =
968 new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), 968 new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
969 contacts[i].pos.Y + (p1.Size.Y/2), 969 contacts[i].pos.Y + (p1.Size.Y/2),
@@ -981,7 +981,7 @@ namespace OpenSim.Region.Physics.OdePlugin
981 981
982 //p2.CollidingObj = true; 982 //p2.CollidingObj = true;
983 contacts[i].depth = 0.00000003f; 983 contacts[i].depth = 0.00000003f;
984 p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 0.5f); 984 p1.Velocity = p1.Velocity + new Vector3(0f, 0f, 0.5f);
985 contacts[i].pos = 985 contacts[i].pos =
986 new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), 986 new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
987 contacts[i].pos.Y + (p1.Size.Y/2), 987 contacts[i].pos.Y + (p1.Size.Y/2),
@@ -1646,9 +1646,9 @@ namespace OpenSim.Region.Physics.OdePlugin
1646 1646
1647 #region Add/Remove Entities 1647 #region Add/Remove Entities
1648 1648
1649 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) 1649 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
1650 { 1650 {
1651 PhysicsVector pos = new PhysicsVector(); 1651 Vector3 pos;
1652 pos.X = position.X; 1652 pos.X = position.X;
1653 pos.Y = position.Y; 1653 pos.Y = position.Y;
1654 pos.Z = position.Z; 1654 pos.Z = position.Z;
@@ -1698,18 +1698,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1698 1698
1699 } 1699 }
1700 1700
1701 private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, 1701 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
1702 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) 1702 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
1703 { 1703 {
1704 1704
1705 PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z); 1705 Vector3 pos = position;
1706 //pos.X = position.X; 1706 Vector3 siz = size;
1707 //pos.Y = position.Y;
1708 //pos.Z = position.Z;
1709 PhysicsVector siz = new PhysicsVector();
1710 siz.X = size.X;
1711 siz.Y = size.Y;
1712 siz.Z = size.Z;
1713 Quaternion rot = rotation; 1707 Quaternion rot = rotation;
1714 1708
1715 OdePrim newPrim; 1709 OdePrim newPrim;
@@ -1736,14 +1730,14 @@ namespace OpenSim.Region.Physics.OdePlugin
1736 } 1730 }
1737 } 1731 }
1738 1732
1739 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 1733 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
1740 PhysicsVector size, Quaternion rotation) //To be removed 1734 Vector3 size, Quaternion rotation) //To be removed
1741 { 1735 {
1742 return AddPrimShape(primName, pbs, position, size, rotation, false); 1736 return AddPrimShape(primName, pbs, position, size, rotation, false);
1743 } 1737 }
1744 1738
1745 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 1739 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
1746 PhysicsVector size, Quaternion rotation, bool isPhysical) 1740 Vector3 size, Quaternion rotation, bool isPhysical)
1747 { 1741 {
1748 PhysicsActor result; 1742 PhysicsActor result;
1749 IMesh mesh = null; 1743 IMesh mesh = null;
@@ -1976,7 +1970,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1976 // this joint will just be added to a waiting list that is NOT processed during the main 1970 // this joint will just be added to a waiting list that is NOT processed during the main
1977 // Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests. 1971 // Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests.
1978 1972
1979 public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position, 1973 public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position,
1980 Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation) 1974 Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation)
1981 1975
1982 { 1976 {
@@ -1984,7 +1978,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1984 OdePhysicsJoint joint = new OdePhysicsJoint(); 1978 OdePhysicsJoint joint = new OdePhysicsJoint();
1985 joint.ObjectNameInScene = objectNameInScene; 1979 joint.ObjectNameInScene = objectNameInScene;
1986 joint.Type = jointType; 1980 joint.Type = jointType;
1987 joint.Position = new PhysicsVector(position.X, position.Y, position.Z); 1981 joint.Position = position;
1988 joint.Rotation = rotation; 1982 joint.Rotation = rotation;
1989 joint.RawParams = parms; 1983 joint.RawParams = parms;
1990 joint.BodyNames = new List<string>(bodyNames); 1984 joint.BodyNames = new List<string>(bodyNames);
@@ -2036,7 +2030,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2036 } 2030 }
2037 2031
2038 // normally called from within OnJointMoved, which is called from within a lock (OdeLock) 2032 // normally called from within OnJointMoved, which is called from within a lock (OdeLock)
2039 public override PhysicsVector GetJointAnchor(PhysicsJoint joint) 2033 public override Vector3 GetJointAnchor(PhysicsJoint joint)
2040 { 2034 {
2041 Debug.Assert(joint.IsInPhysicsEngine); 2035 Debug.Assert(joint.IsInPhysicsEngine);
2042 d.Vector3 pos = new d.Vector3(); 2036 d.Vector3 pos = new d.Vector3();
@@ -2058,14 +2052,14 @@ namespace OpenSim.Region.Physics.OdePlugin
2058 break; 2052 break;
2059 } 2053 }
2060 } 2054 }
2061 return new PhysicsVector(pos.X, pos.Y, pos.Z); 2055 return new Vector3(pos.X, pos.Y, pos.Z);
2062 } 2056 }
2063 2057
2064 // normally called from within OnJointMoved, which is called from within a lock (OdeLock) 2058 // normally called from within OnJointMoved, which is called from within a lock (OdeLock)
2065 // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function 2059 // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function
2066 // appears to be unreliable. Fortunately we can compute the joint axis ourselves by 2060 // appears to be unreliable. Fortunately we can compute the joint axis ourselves by
2067 // keeping track of the joint's original orientation relative to one of the involved bodies. 2061 // keeping track of the joint's original orientation relative to one of the involved bodies.
2068 public override PhysicsVector GetJointAxis(PhysicsJoint joint) 2062 public override Vector3 GetJointAxis(PhysicsJoint joint)
2069 { 2063 {
2070 Debug.Assert(joint.IsInPhysicsEngine); 2064 Debug.Assert(joint.IsInPhysicsEngine);
2071 d.Vector3 axis = new d.Vector3(); 2065 d.Vector3 axis = new d.Vector3();
@@ -2087,7 +2081,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2087 break; 2081 break;
2088 } 2082 }
2089 } 2083 }
2090 return new PhysicsVector(axis.X, axis.Y, axis.Z); 2084 return new Vector3(axis.X, axis.Y, axis.Z);
2091 } 2085 }
2092 2086
2093 2087
@@ -2255,7 +2249,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2255 /// <param name="pos">the position that the geom moved to</param> 2249 /// <param name="pos">the position that the geom moved to</param>
2256 /// <param name="currentspace">a pointer to the space it was in before it was moved.</param> 2250 /// <param name="currentspace">a pointer to the space it was in before it was moved.</param>
2257 /// <returns>a pointer to the new space it's in</returns> 2251 /// <returns>a pointer to the new space it's in</returns>
2258 public IntPtr recalculateSpaceForGeom(IntPtr geom, PhysicsVector pos, IntPtr currentspace) 2252 public IntPtr recalculateSpaceForGeom(IntPtr geom, Vector3 pos, IntPtr currentspace)
2259 { 2253 {
2260 // Called from setting the Position and Size of an ODEPrim so 2254 // Called from setting the Position and Size of an ODEPrim so
2261 // it's already in locked space. 2255 // it's already in locked space.
@@ -2402,7 +2396,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2402 /// </summary> 2396 /// </summary>
2403 /// <param name="pos"></param> 2397 /// <param name="pos"></param>
2404 /// <returns>a pointer to the space. This could be a new space or reused space.</returns> 2398 /// <returns>a pointer to the space. This could be a new space or reused space.</returns>
2405 public IntPtr calculateSpaceForGeom(PhysicsVector pos) 2399 public IntPtr calculateSpaceForGeom(Vector3 pos)
2406 { 2400 {
2407 int[] xyspace = calculateSpaceArrayItemFromPos(pos); 2401 int[] xyspace = calculateSpaceArrayItemFromPos(pos);
2408 //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); 2402 //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString());
@@ -2414,7 +2408,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2414 /// </summary> 2408 /// </summary>
2415 /// <param name="pos"></param> 2409 /// <param name="pos"></param>
2416 /// <returns>an array item based on the position</returns> 2410 /// <returns>an array item based on the position</returns>
2417 public int[] calculateSpaceArrayItemFromPos(PhysicsVector pos) 2411 public int[] calculateSpaceArrayItemFromPos(Vector3 pos)
2418 { 2412 {
2419 int[] returnint = new int[2]; 2413 int[] returnint = new int[2];
2420 2414
diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
index cdd38c4..69e2d03 100644
--- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
+++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
@@ -76,8 +76,8 @@ namespace OpenSim.Region.Physics.OdePlugin
76 public void CreateAndDropPhysicalCube() 76 public void CreateAndDropPhysicalCube()
77 { 77 {
78 PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox(); 78 PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox();
79 PhysicsVector position = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); 79 Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f);
80 PhysicsVector size = new PhysicsVector(0.5f, 0.5f, 0.5f); 80 Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
81 Quaternion rot = Quaternion.Identity; 81 Quaternion rot = Quaternion.Identity;
82 PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true); 82 PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true);
83 OdePrim oprim = (OdePrim)prim; 83 OdePrim oprim = (OdePrim)prim;
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
index 35fc616..26cd1dd 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
@@ -36,20 +36,17 @@ namespace OpenSim.Region.Physics.POSPlugin
36{ 36{
37 public class POSCharacter : PhysicsActor 37 public class POSCharacter : PhysicsActor
38 { 38 {
39 private PhysicsVector _position; 39 private Vector3 _position;
40 public PhysicsVector _velocity; 40 public Vector3 _velocity;
41 public PhysicsVector _target_velocity = PhysicsVector.Zero; 41 public Vector3 _target_velocity = Vector3.Zero;
42 public PhysicsVector _size = PhysicsVector.Zero; 42 public Vector3 _size = Vector3.Zero;
43 private PhysicsVector _acceleration; 43 private Vector3 _acceleration;
44 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 44 private Vector3 m_rotationalVelocity = Vector3.Zero;
45 private bool flying; 45 private bool flying;
46 private bool isColliding; 46 private bool isColliding;
47 47
48 public POSCharacter() 48 public POSCharacter()
49 { 49 {
50 _velocity = new PhysicsVector();
51 _position = new PhysicsVector();
52 _acceleration = new PhysicsVector();
53 } 50 }
54 51
55 public override int PhysicsActorType 52 public override int PhysicsActorType
@@ -58,7 +55,7 @@ namespace OpenSim.Region.Physics.POSPlugin
58 set { return; } 55 set { return; }
59 } 56 }
60 57
61 public override PhysicsVector RotationalVelocity 58 public override Vector3 RotationalVelocity
62 { 59 {
63 get { return m_rotationalVelocity; } 60 get { return m_rotationalVelocity; }
64 set { m_rotationalVelocity = value; } 61 set { m_rotationalVelocity = value; }
@@ -137,13 +134,13 @@ namespace OpenSim.Region.Physics.POSPlugin
137 get { return false; } 134 get { return false; }
138 } 135 }
139 136
140 public override PhysicsVector Position 137 public override Vector3 Position
141 { 138 {
142 get { return _position; } 139 get { return _position; }
143 set { _position = value; } 140 set { _position = value; }
144 } 141 }
145 142
146 public override PhysicsVector Size 143 public override Vector3 Size
147 { 144 {
148 get { return _size; } 145 get { return _size; }
149 set 146 set
@@ -158,9 +155,9 @@ namespace OpenSim.Region.Physics.POSPlugin
158 get { return 0f; } 155 get { return 0f; }
159 } 156 }
160 157
161 public override PhysicsVector Force 158 public override Vector3 Force
162 { 159 {
163 get { return PhysicsVector.Zero; } 160 get { return Vector3.Zero; }
164 set { return; } 161 set { return; }
165 } 162 }
166 163
@@ -175,7 +172,7 @@ namespace OpenSim.Region.Physics.POSPlugin
175 172
176 } 173 }
177 174
178 public override void VehicleVectorParam(int param, PhysicsVector value) 175 public override void VehicleVectorParam(int param, Vector3 value)
179 { 176 {
180 177
181 } 178 }
@@ -190,14 +187,14 @@ namespace OpenSim.Region.Physics.POSPlugin
190 187
191 } 188 }
192 189
193 public override PhysicsVector CenterOfMass 190 public override Vector3 CenterOfMass
194 { 191 {
195 get { return PhysicsVector.Zero; } 192 get { return Vector3.Zero; }
196 } 193 }
197 194
198 public override PhysicsVector GeometricCenter 195 public override Vector3 GeometricCenter
199 { 196 {
200 get { return PhysicsVector.Zero; } 197 get { return Vector3.Zero; }
201 } 198 }
202 199
203 public override PrimitiveBaseShape Shape 200 public override PrimitiveBaseShape Shape
@@ -205,15 +202,15 @@ namespace OpenSim.Region.Physics.POSPlugin
205 set { return; } 202 set { return; }
206 } 203 }
207 204
208 public override PhysicsVector Velocity 205 public override Vector3 Velocity
209 { 206 {
210 get { return _velocity; } 207 get { return _velocity; }
211 set { _target_velocity = value; } 208 set { _target_velocity = value; }
212 } 209 }
213 210
214 public override PhysicsVector Torque 211 public override Vector3 Torque
215 { 212 {
216 get { return PhysicsVector.Zero; } 213 get { return Vector3.Zero; }
217 set { return; } 214 set { return; }
218 } 215 }
219 216
@@ -229,7 +226,7 @@ namespace OpenSim.Region.Physics.POSPlugin
229 set { } 226 set { }
230 } 227 }
231 228
232 public override PhysicsVector Acceleration 229 public override Vector3 Acceleration
233 { 230 {
234 get { return _acceleration; } 231 get { return _acceleration; }
235 } 232 }
@@ -248,24 +245,24 @@ namespace OpenSim.Region.Physics.POSPlugin
248 { 245 {
249 } 246 }
250 247
251 public override void LockAngularMotion(PhysicsVector axis) 248 public override void LockAngularMotion(Vector3 axis)
252 { 249 {
253 } 250 }
254 251
255 public void SetAcceleration(PhysicsVector accel) 252 public void SetAcceleration(Vector3 accel)
256 { 253 {
257 _acceleration = accel; 254 _acceleration = accel;
258 } 255 }
259 256
260 public override void AddForce(PhysicsVector force, bool pushforce) 257 public override void AddForce(Vector3 force, bool pushforce)
261 { 258 {
262 } 259 }
263 260
264 public override void AddAngularForce(PhysicsVector force, bool pushforce) 261 public override void AddAngularForce(Vector3 force, bool pushforce)
265 { 262 {
266 } 263 }
267 264
268 public override void SetMomentum(PhysicsVector momentum) 265 public override void SetMomentum(Vector3 momentum)
269 { 266 {
270 } 267 }
271 268
@@ -273,7 +270,7 @@ namespace OpenSim.Region.Physics.POSPlugin
273 { 270 {
274 } 271 }
275 272
276 public override PhysicsVector PIDTarget 273 public override Vector3 PIDTarget
277 { 274 {
278 set { return; } 275 set { return; }
279 } 276 }
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
index b50364b..96c3e26 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
@@ -36,19 +36,16 @@ namespace OpenSim.Region.Physics.POSPlugin
36{ 36{
37 public class POSPrim : PhysicsActor 37 public class POSPrim : PhysicsActor
38 { 38 {
39 private PhysicsVector _position; 39 private Vector3 _position;
40 private PhysicsVector _velocity; 40 private Vector3 _velocity;
41 private PhysicsVector _acceleration; 41 private Vector3 _acceleration;
42 private PhysicsVector _size; 42 private Vector3 _size;
43 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 43 private Vector3 m_rotationalVelocity = Vector3.Zero;
44 private Quaternion _orientation; 44 private Quaternion _orientation;
45 private bool iscolliding; 45 private bool iscolliding;
46 46
47 public POSPrim() 47 public POSPrim()
48 { 48 {
49 _velocity = new PhysicsVector();
50 _position = new PhysicsVector();
51 _acceleration = new PhysicsVector();
52 } 49 }
53 50
54 public override int PhysicsActorType 51 public override int PhysicsActorType
@@ -57,7 +54,7 @@ namespace OpenSim.Region.Physics.POSPlugin
57 set { return; } 54 set { return; }
58 } 55 }
59 56
60 public override PhysicsVector RotationalVelocity 57 public override Vector3 RotationalVelocity
61 { 58 {
62 get { return m_rotationalVelocity; } 59 get { return m_rotationalVelocity; }
63 set { m_rotationalVelocity = value; } 60 set { m_rotationalVelocity = value; }
@@ -98,13 +95,13 @@ namespace OpenSim.Region.Physics.POSPlugin
98 get { return false; } 95 get { return false; }
99 } 96 }
100 97
101 public override PhysicsVector Position 98 public override Vector3 Position
102 { 99 {
103 get { return _position; } 100 get { return _position; }
104 set { _position = value; } 101 set { _position = value; }
105 } 102 }
106 103
107 public override PhysicsVector Size 104 public override Vector3 Size
108 { 105 {
109 get { return _size; } 106 get { return _size; }
110 set { _size = value; } 107 set { _size = value; }
@@ -115,9 +112,9 @@ namespace OpenSim.Region.Physics.POSPlugin
115 get { return 0f; } 112 get { return 0f; }
116 } 113 }
117 114
118 public override PhysicsVector Force 115 public override Vector3 Force
119 { 116 {
120 get { return PhysicsVector.Zero; } 117 get { return Vector3.Zero; }
121 set { return; } 118 set { return; }
122 } 119 }
123 120
@@ -132,7 +129,7 @@ namespace OpenSim.Region.Physics.POSPlugin
132 129
133 } 130 }
134 131
135 public override void VehicleVectorParam(int param, PhysicsVector value) 132 public override void VehicleVectorParam(int param, Vector3 value)
136 { 133 {
137 134
138 } 135 }
@@ -147,14 +144,14 @@ namespace OpenSim.Region.Physics.POSPlugin
147 144
148 } 145 }
149 146
150 public override PhysicsVector CenterOfMass 147 public override Vector3 CenterOfMass
151 { 148 {
152 get { return PhysicsVector.Zero; } 149 get { return Vector3.Zero; }
153 } 150 }
154 151
155 public override PhysicsVector GeometricCenter 152 public override Vector3 GeometricCenter
156 { 153 {
157 get { return PhysicsVector.Zero; } 154 get { return Vector3.Zero; }
158 } 155 }
159 156
160 public override PrimitiveBaseShape Shape 157 public override PrimitiveBaseShape Shape
@@ -173,7 +170,7 @@ namespace OpenSim.Region.Physics.POSPlugin
173 set { return; } 170 set { return; }
174 } 171 }
175 172
176 public override PhysicsVector Velocity 173 public override Vector3 Velocity
177 { 174 {
178 get { return _velocity; } 175 get { return _velocity; }
179 set { _velocity = value; } 176 set { _velocity = value; }
@@ -191,7 +188,7 @@ namespace OpenSim.Region.Physics.POSPlugin
191 set { _orientation = value; } 188 set { _orientation = value; }
192 } 189 }
193 190
194 public override PhysicsVector Acceleration 191 public override Vector3 Acceleration
195 { 192 {
196 get { return _acceleration; } 193 get { return _acceleration; }
197 } 194 }
@@ -202,26 +199,26 @@ namespace OpenSim.Region.Physics.POSPlugin
202 set { } 199 set { }
203 } 200 }
204 201
205 public void SetAcceleration(PhysicsVector accel) 202 public void SetAcceleration(Vector3 accel)
206 { 203 {
207 _acceleration = accel; 204 _acceleration = accel;
208 } 205 }
209 206
210 public override void AddForce(PhysicsVector force, bool pushforce) 207 public override void AddForce(Vector3 force, bool pushforce)
211 { 208 {
212 } 209 }
213 210
214 public override void AddAngularForce(PhysicsVector force, bool pushforce) 211 public override void AddAngularForce(Vector3 force, bool pushforce)
215 { 212 {
216 } 213 }
217 214
218 public override PhysicsVector Torque 215 public override Vector3 Torque
219 { 216 {
220 get { return PhysicsVector.Zero; } 217 get { return Vector3.Zero; }
221 set { return; } 218 set { return; }
222 } 219 }
223 220
224 public override void SetMomentum(PhysicsVector momentum) 221 public override void SetMomentum(Vector3 momentum)
225 { 222 {
226 } 223 }
227 224
@@ -255,7 +252,7 @@ namespace OpenSim.Region.Physics.POSPlugin
255 { 252 {
256 } 253 }
257 254
258 public override void LockAngularMotion(PhysicsVector axis) 255 public override void LockAngularMotion(Vector3 axis)
259 { 256 {
260 } 257 }
261 258
@@ -268,7 +265,7 @@ namespace OpenSim.Region.Physics.POSPlugin
268 { 265 {
269 } 266 }
270 267
271 public override PhysicsVector PIDTarget 268 public override Vector3 PIDTarget
272 { 269 {
273 set { return; } 270 set { return; }
274 } 271 }
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
index fa8cc70..c3f5040 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.POSPlugin
56 { 56 {
57 } 57 }
58 58
59 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) 59 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
60 { 60 {
61 POSCharacter act = new POSCharacter(); 61 POSCharacter act = new POSCharacter();
62 act.Position = position; 62 act.Position = position;
@@ -84,20 +84,20 @@ namespace OpenSim.Region.Physics.POSPlugin
84 } 84 }
85 85
86/* 86/*
87 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) 87 public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
88 { 88 {
89 return null; 89 return null;
90 } 90 }
91*/ 91*/
92 92
93 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 93 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
94 PhysicsVector size, Quaternion rotation) 94 Vector3 size, Quaternion rotation)
95 { 95 {
96 return AddPrimShape(primName, pbs, position, size, rotation, false); 96 return AddPrimShape(primName, pbs, position, size, rotation, false);
97 } 97 }
98 98
99 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 99 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
100 PhysicsVector size, Quaternion rotation, bool isPhysical) 100 Vector3 size, Quaternion rotation, bool isPhysical)
101 { 101 {
102 POSPrim prim = new POSPrim(); 102 POSPrim prim = new POSPrim();
103 prim.Position = position; 103 prim.Position = position;
@@ -152,23 +152,25 @@ namespace OpenSim.Region.Physics.POSPlugin
152 character._target_velocity.Z += gravity * timeStep; 152 character._target_velocity.Z += gravity * timeStep;
153 } 153 }
154 154
155 character.Position.X += character._target_velocity.X * timeStep; 155 Vector3 characterPosition = character.Position;
156 character.Position.Y += character._target_velocity.Y * timeStep;
157 156
158 character.Position.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f); 157 characterPosition.X += character._target_velocity.X * timeStep;
159 character.Position.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f); 158 characterPosition.Y += character._target_velocity.Y * timeStep;
159
160 characterPosition.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
161 characterPosition.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
160 162
161 bool forcedZ = false; 163 bool forcedZ = false;
162 164
163 float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X]; 165 float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X];
164 if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2) 166 if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2)
165 { 167 {
166 character.Position.Z = terrainheight + character.Size.Z; 168 characterPosition.Z = terrainheight + character.Size.Z;
167 forcedZ = true; 169 forcedZ = true;
168 } 170 }
169 else 171 else
170 { 172 {
171 character.Position.Z += character._target_velocity.Z*timeStep; 173 characterPosition.Z += character._target_velocity.Z*timeStep;
172 } 174 }
173 175
174 /// this is it -- the magic you've all been waiting for! Ladies and gentlemen -- 176 /// this is it -- the magic you've all been waiting for! Ladies and gentlemen --
@@ -177,29 +179,29 @@ namespace OpenSim.Region.Physics.POSPlugin
177 179
178 if (isCollidingWithPrim(character)) 180 if (isCollidingWithPrim(character))
179 { 181 {
180 character.Position.Z = oldposZ; // first try Z axis 182 characterPosition.Z = oldposZ; // first try Z axis
181 if (isCollidingWithPrim(character)) 183 if (isCollidingWithPrim(character))
182 { 184 {
183 character.Position.Z = oldposZ + character.Size.Z / 4.4f; // try harder 185 characterPosition.Z = oldposZ + character.Size.Z / 4.4f; // try harder
184 if (isCollidingWithPrim(character)) 186 if (isCollidingWithPrim(character))
185 { 187 {
186 character.Position.Z = oldposZ + character.Size.Z / 2.2f; // try very hard 188 characterPosition.Z = oldposZ + character.Size.Z / 2.2f; // try very hard
187 if (isCollidingWithPrim(character)) 189 if (isCollidingWithPrim(character))
188 { 190 {
189 character.Position.X = oldposX; 191 characterPosition.X = oldposX;
190 character.Position.Y = oldposY; 192 characterPosition.Y = oldposY;
191 character.Position.Z = oldposZ; 193 characterPosition.Z = oldposZ;
192 194
193 character.Position.X += character._target_velocity.X * timeStep; 195 characterPosition.X += character._target_velocity.X * timeStep;
194 if (isCollidingWithPrim(character)) 196 if (isCollidingWithPrim(character))
195 { 197 {
196 character.Position.X = oldposX; 198 characterPosition.X = oldposX;
197 } 199 }
198 200
199 character.Position.Y += character._target_velocity.Y * timeStep; 201 characterPosition.Y += character._target_velocity.Y * timeStep;
200 if (isCollidingWithPrim(character)) 202 if (isCollidingWithPrim(character))
201 { 203 {
202 character.Position.Y = oldposY; 204 characterPosition.Y = oldposY;
203 } 205 }
204 } 206 }
205 else 207 else
@@ -218,8 +220,10 @@ namespace OpenSim.Region.Physics.POSPlugin
218 } 220 }
219 } 221 }
220 222
221 character.Position.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f); 223 characterPosition.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
222 character.Position.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f); 224 characterPosition.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
225
226 character.Position = characterPosition;
223 227
224 character._velocity.X = (character.Position.X - oldposX)/timeStep; 228 character._velocity.X = (character.Position.X - oldposX)/timeStep;
225 character._velocity.Y = (character.Position.Y - oldposY)/timeStep; 229 character._velocity.Y = (character.Position.Y - oldposY)/timeStep;
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index e7d989c..8bdb18d 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -34,6 +34,7 @@ using PhysXWrapper;
34using Quaternion=OpenMetaverse.Quaternion; 34using Quaternion=OpenMetaverse.Quaternion;
35using System.Reflection; 35using System.Reflection;
36using log4net; 36using log4net;
37using OpenMetaverse;
37 38
38namespace OpenSim.Region.Physics.PhysXPlugin 39namespace OpenSim.Region.Physics.PhysXPlugin
39{ 40{
@@ -106,7 +107,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
106 107
107 } 108 }
108 109
109 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) 110 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
110 { 111 {
111 Vec3 pos = new Vec3(); 112 Vec3 pos = new Vec3();
112 pos.X = position.X; 113 pos.X = position.X;
@@ -127,7 +128,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
127 { 128 {
128 } 129 }
129 130
130 private PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) 131 private PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
131 { 132 {
132 Vec3 pos = new Vec3(); 133 Vec3 pos = new Vec3();
133 pos.X = position.X; 134 pos.X = position.X;
@@ -142,14 +143,14 @@ namespace OpenSim.Region.Physics.PhysXPlugin
142 return act; 143 return act;
143 } 144 }
144 145
145 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 146 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
146 PhysicsVector size, Quaternion rotation) //To be removed 147 Vector3 size, Quaternion rotation) //To be removed
147 { 148 {
148 return AddPrimShape(primName, pbs, position, size, rotation, false); 149 return AddPrimShape(primName, pbs, position, size, rotation, false);
149 } 150 }
150 151
151 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 152 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
152 PhysicsVector size, Quaternion rotation, bool isPhysical) 153 Vector3 size, Quaternion rotation, bool isPhysical)
153 { 154 {
154 return AddPrim(position, size, rotation); 155 return AddPrim(position, size, rotation);
155 } 156 }
@@ -219,10 +220,10 @@ namespace OpenSim.Region.Physics.PhysXPlugin
219 220
220 public class PhysXCharacter : PhysicsActor 221 public class PhysXCharacter : PhysicsActor
221 { 222 {
222 private PhysicsVector _position; 223 private Vector3 _position;
223 private PhysicsVector _velocity; 224 private Vector3 _velocity;
224 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 225 private Vector3 m_rotationalVelocity = Vector3.Zero;
225 private PhysicsVector _acceleration; 226 private Vector3 _acceleration;
226 private NxCharacter _character; 227 private NxCharacter _character;
227 private bool flying; 228 private bool flying;
228 private bool iscolliding = false; 229 private bool iscolliding = false;
@@ -230,9 +231,6 @@ namespace OpenSim.Region.Physics.PhysXPlugin
230 231
231 public PhysXCharacter(NxCharacter character) 232 public PhysXCharacter(NxCharacter character)
232 { 233 {
233 _velocity = new PhysicsVector();
234 _position = new PhysicsVector();
235 _acceleration = new PhysicsVector();
236 _character = character; 234 _character = character;
237 } 235 }
238 236
@@ -310,7 +308,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
310 set { return; } 308 set { return; }
311 } 309 }
312 310
313 public override PhysicsVector RotationalVelocity 311 public override Vector3 RotationalVelocity
314 { 312 {
315 get { return m_rotationalVelocity; } 313 get { return m_rotationalVelocity; }
316 set { m_rotationalVelocity = value; } 314 set { m_rotationalVelocity = value; }
@@ -321,7 +319,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
321 get { return false; } 319 get { return false; }
322 } 320 }
323 321
324 public override PhysicsVector Position 322 public override Vector3 Position
325 { 323 {
326 get { return _position; } 324 get { return _position; }
327 set 325 set
@@ -335,9 +333,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
335 } 333 }
336 } 334 }
337 335
338 public override PhysicsVector Size 336 public override Vector3 Size
339 { 337 {
340 get { return PhysicsVector.Zero; } 338 get { return Vector3.Zero; }
341 set { } 339 set { }
342 } 340 }
343 341
@@ -346,9 +344,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
346 get { return 0f; } 344 get { return 0f; }
347 } 345 }
348 346
349 public override PhysicsVector Force 347 public override Vector3 Force
350 { 348 {
351 get { return PhysicsVector.Zero; } 349 get { return Vector3.Zero; }
352 set { return; } 350 set { return; }
353 } 351 }
354 352
@@ -363,7 +361,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
363 361
364 } 362 }
365 363
366 public override void VehicleVectorParam(int param, PhysicsVector value) 364 public override void VehicleVectorParam(int param, Vector3 value)
367 { 365 {
368 366
369 } 367 }
@@ -379,17 +377,17 @@ namespace OpenSim.Region.Physics.PhysXPlugin
379 } 377 }
380 378
381 379
382 public override PhysicsVector CenterOfMass 380 public override Vector3 CenterOfMass
383 { 381 {
384 get { return PhysicsVector.Zero; } 382 get { return Vector3.Zero; }
385 } 383 }
386 384
387 public override PhysicsVector GeometricCenter 385 public override Vector3 GeometricCenter
388 { 386 {
389 get { return PhysicsVector.Zero; } 387 get { return Vector3.Zero; }
390 } 388 }
391 389
392 public override PhysicsVector Velocity 390 public override Vector3 Velocity
393 { 391 {
394 get { return _velocity; } 392 get { return _velocity; }
395 set { _velocity = value; } 393 set { _velocity = value; }
@@ -413,25 +411,25 @@ namespace OpenSim.Region.Physics.PhysXPlugin
413 set { } 411 set { }
414 } 412 }
415 413
416 public override PhysicsVector Acceleration 414 public override Vector3 Acceleration
417 { 415 {
418 get { return _acceleration; } 416 get { return _acceleration; }
419 } 417 }
420 418
421 public void SetAcceleration(PhysicsVector accel) 419 public void SetAcceleration(Vector3 accel)
422 { 420 {
423 _acceleration = accel; 421 _acceleration = accel;
424 } 422 }
425 423
426 public override void AddForce(PhysicsVector force, bool pushforce) 424 public override void AddForce(Vector3 force, bool pushforce)
427 { 425 {
428 } 426 }
429 public override PhysicsVector Torque 427 public override Vector3 Torque
430 { 428 {
431 get { return PhysicsVector.Zero; } 429 get { return Vector3.Zero; }
432 set { return; } 430 set { return; }
433 } 431 }
434 public override void AddAngularForce(PhysicsVector force, bool pushforce) 432 public override void AddAngularForce(Vector3 force, bool pushforce)
435 { 433 {
436 } 434 }
437 435
@@ -445,12 +443,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin
445 443
446 } 444 }
447 445
448 public override void LockAngularMotion(PhysicsVector axis) 446 public override void LockAngularMotion(Vector3 axis)
449 { 447 {
450 448
451 } 449 }
452 450
453 public override void SetMomentum(PhysicsVector momentum) 451 public override void SetMomentum(Vector3 momentum)
454 { 452 {
455 } 453 }
456 454
@@ -492,7 +490,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
492 490
493 } 491 }
494 492
495 public override PhysicsVector PIDTarget { set { return; } } 493 public override Vector3 PIDTarget { set { return; } }
496 public override bool PIDActive { set { return; } } 494 public override bool PIDActive { set { return; } }
497 public override float PIDTau { set { return; } } 495 public override float PIDTau { set { return; } }
498 496
@@ -518,15 +516,15 @@ namespace OpenSim.Region.Physics.PhysXPlugin
518 516
519 public class PhysXPrim : PhysicsActor 517 public class PhysXPrim : PhysicsActor
520 { 518 {
521 private PhysicsVector _velocity; 519 private Vector3 _velocity;
522 private PhysicsVector _acceleration; 520 private Vector3 _acceleration;
523 private PhysicsVector m_rotationalVelocity; 521 private Vector3 m_rotationalVelocity;
524 private NxActor _prim; 522 private NxActor _prim;
525 523
526 public PhysXPrim(NxActor prim) 524 public PhysXPrim(NxActor prim)
527 { 525 {
528 _velocity = new PhysicsVector(); 526 _velocity = Vector3.Zero;
529 _acceleration = new PhysicsVector(); 527 _acceleration = Vector3.Zero;
530 _prim = prim; 528 _prim = prim;
531 } 529 }
532 530
@@ -580,7 +578,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
580 set { return; } 578 set { return; }
581 } 579 }
582 580
583 public override PhysicsVector RotationalVelocity 581 public override Vector3 RotationalVelocity
584 { 582 {
585 get { return m_rotationalVelocity; } 583 get { return m_rotationalVelocity; }
586 set { m_rotationalVelocity = value; } 584 set { m_rotationalVelocity = value; }
@@ -616,11 +614,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
616 get { return false; } 614 get { return false; }
617 } 615 }
618 616
619 public override PhysicsVector Position 617 public override Vector3 Position
620 { 618 {
621 get 619 get
622 { 620 {
623 PhysicsVector pos = new PhysicsVector(); 621 Vector3 pos = Vector3.Zero;
624 Vec3 vec = _prim.Position; 622 Vec3 vec = _prim.Position;
625 pos.X = vec.X; 623 pos.X = vec.X;
626 pos.Y = vec.Y; 624 pos.Y = vec.Y;
@@ -629,7 +627,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
629 } 627 }
630 set 628 set
631 { 629 {
632 PhysicsVector vec = value; 630 Vector3 vec = value;
633 Vec3 pos = new Vec3(); 631 Vec3 pos = new Vec3();
634 pos.X = vec.X; 632 pos.X = vec.X;
635 pos.Y = vec.Y; 633 pos.Y = vec.Y;
@@ -643,15 +641,15 @@ namespace OpenSim.Region.Physics.PhysXPlugin
643 set { return; } 641 set { return; }
644 } 642 }
645 643
646 public override PhysicsVector Velocity 644 public override Vector3 Velocity
647 { 645 {
648 get { return _velocity; } 646 get { return _velocity; }
649 set { _velocity = value; } 647 set { _velocity = value; }
650 } 648 }
651 649
652 public override PhysicsVector Torque 650 public override Vector3 Torque
653 { 651 {
654 get { return PhysicsVector.Zero; } 652 get { return Vector3.Zero; }
655 set { return; } 653 set { return; }
656 } 654 }
657 655
@@ -682,31 +680,31 @@ namespace OpenSim.Region.Physics.PhysXPlugin
682 set { } 680 set { }
683 } 681 }
684 682
685 public override PhysicsVector Acceleration 683 public override Vector3 Acceleration
686 { 684 {
687 get { return _acceleration; } 685 get { return _acceleration; }
688 } 686 }
689 687
690 public void SetAcceleration(PhysicsVector accel) 688 public void SetAcceleration(Vector3 accel)
691 { 689 {
692 _acceleration = accel; 690 _acceleration = accel;
693 } 691 }
694 692
695 public override void AddForce(PhysicsVector force, bool pushforce) 693 public override void AddForce(Vector3 force, bool pushforce)
696 { 694 {
697 } 695 }
698 696
699 public override void AddAngularForce(PhysicsVector force, bool pushforce) 697 public override void AddAngularForce(Vector3 force, bool pushforce)
700 { 698 {
701 } 699 }
702 700
703 public override void SetMomentum(PhysicsVector momentum) 701 public override void SetMomentum(Vector3 momentum)
704 { 702 {
705 } 703 }
706 704
707 public override PhysicsVector Size 705 public override Vector3 Size
708 { 706 {
709 get { return PhysicsVector.Zero; } 707 get { return Vector3.Zero; }
710 set { } 708 set { }
711 } 709 }
712 710
@@ -718,7 +716,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
718 { 716 {
719 } 717 }
720 718
721 public override void LockAngularMotion(PhysicsVector axis) 719 public override void LockAngularMotion(Vector3 axis)
722 { 720 {
723 721
724 } 722 }
@@ -728,9 +726,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
728 get { return 0f; } 726 get { return 0f; }
729 } 727 }
730 728
731 public override PhysicsVector Force 729 public override Vector3 Force
732 { 730 {
733 get { return PhysicsVector.Zero; } 731 get { return Vector3.Zero; }
734 set { return; } 732 set { return; }
735 } 733 }
736 734
@@ -745,7 +743,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
745 743
746 } 744 }
747 745
748 public override void VehicleVectorParam(int param, PhysicsVector value) 746 public override void VehicleVectorParam(int param, Vector3 value)
749 { 747 {
750 748
751 } 749 }
@@ -760,21 +758,21 @@ namespace OpenSim.Region.Physics.PhysXPlugin
760 758
761 } 759 }
762 760
763 public override PhysicsVector CenterOfMass 761 public override Vector3 CenterOfMass
764 { 762 {
765 get { return PhysicsVector.Zero; } 763 get { return Vector3.Zero; }
766 } 764 }
767 765
768 public override PhysicsVector GeometricCenter 766 public override Vector3 GeometricCenter
769 { 767 {
770 get { return PhysicsVector.Zero; } 768 get { return Vector3.Zero; }
771 } 769 }
772 770
773 public override void CrossingFailure() 771 public override void CrossingFailure()
774 { 772 {
775 } 773 }
776 774
777 public override PhysicsVector PIDTarget { set { return; } } 775 public override Vector3 PIDTarget { set { return; } }
778 public override bool PIDActive { set { return; } } 776 public override bool PIDActive { set { return; } }
779 public override float PIDTau { set { return; } } 777 public override float PIDTau { set { return; } }
780 778
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 56d4d28..3849558 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2047,7 +2047,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2047 if (local != 0) 2047 if (local != 0)
2048 force *= llGetRot(); 2048 force *= llGetRot();
2049 2049
2050 m_host.ParentGroup.RootPart.SetForce(new PhysicsVector((float)force.x, (float)force.y, (float)force.z)); 2050 m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z));
2051 } 2051 }
2052 } 2052 }
2053 } 2053 }
@@ -2062,7 +2062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2062 { 2062 {
2063 if (!m_host.ParentGroup.IsDeleted) 2063 if (!m_host.ParentGroup.IsDeleted)
2064 { 2064 {
2065 PhysicsVector tmpForce = m_host.ParentGroup.RootPart.GetForce(); 2065 Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce();
2066 force.x = tmpForce.X; 2066 force.x = tmpForce.X;
2067 force.y = tmpForce.Y; 2067 force.y = tmpForce.Y;
2068 force.z = tmpForce.Z; 2068 force.z = tmpForce.Z;
@@ -4180,7 +4180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4180 { 4180 {
4181 applied_linear_impulse *= m_host.GetWorldRotation(); 4181 applied_linear_impulse *= m_host.GetWorldRotation();
4182 } 4182 }
4183 pusheeav.PhysicsActor.AddForce(new PhysicsVector(applied_linear_impulse.X, applied_linear_impulse.Y, applied_linear_impulse.Z), true); 4183 pusheeav.PhysicsActor.AddForce(applied_linear_impulse, true);
4184 } 4184 }
4185 } 4185 }
4186 } 4186 }
@@ -6088,7 +6088,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6088 if (!m_host.ParentGroup.IsDeleted) 6088 if (!m_host.ParentGroup.IsDeleted)
6089 { 6089 {
6090 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, 6090 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
6091 new PhysicsVector((float)vec.x, (float)vec.y, (float)vec.z)); 6091 new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
6092 } 6092 }
6093 } 6093 }
6094 } 6094 }