aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin
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/Physics/OdePlugin
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/Physics/OdePlugin')
-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
5 files changed, 209 insertions, 229 deletions
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;