aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-26 04:23:36 +0000
committerTeravus Ovares2007-12-26 04:23:36 +0000
commit0e460a81cc7e1c9eb4b5576f78e78400f05cf48a (patch)
treebe375f5f0f693638db507bc533229f0c0ef546d8 /OpenSim/Region/Physics/OdePlugin
parent* Added a -val heightfield value limiter so giant pits of death don't cause a... (diff)
downloadopensim-SC-0e460a81cc7e1c9eb4b5576f78e78400f05cf48a.zip
opensim-SC-0e460a81cc7e1c9eb4b5576f78e78400f05cf48a.tar.gz
opensim-SC-0e460a81cc7e1c9eb4b5576f78e78400f05cf48a.tar.bz2
opensim-SC-0e460a81cc7e1c9eb4b5576f78e78400f05cf48a.tar.xz
* Coded around another Null packet sent by the packet pool
* Condensed 8 calls to unmanaged code in ODE down to 1
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs36
1 files changed, 27 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 273ee23..33b2e4f 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -40,6 +40,7 @@ namespace OpenSim.Region.Physics.OdePlugin
40 { 40 {
41 private PhysicsVector _position; 41 private PhysicsVector _position;
42 private d.Vector3 _zeroPosition; 42 private d.Vector3 _zeroPosition;
43 private d.Matrix3 m_StandUpRotation;
43 private bool _zeroFlag = false; 44 private bool _zeroFlag = false;
44 private bool m_lastUpdateSent = false; 45 private bool m_lastUpdateSent = false;
45 private PhysicsVector _velocity; 46 private PhysicsVector _velocity;
@@ -86,6 +87,8 @@ namespace OpenSim.Region.Physics.OdePlugin
86 _acceleration = new PhysicsVector(); 87 _acceleration = new PhysicsVector();
87 _parent_scene = parent_scene; 88 _parent_scene = parent_scene;
88 89
90 m_StandUpRotation = new d.Matrix3(0.8184158f, -0.5744568f, -0.0139677f, 0.5744615f, 0.8185215f, -0.004074608f, 0.01377355f, -0.004689182f, 0.9998941f);
91
89 for (int i = 0; i < 11; i++) 92 for (int i = 0; i < 11; i++)
90 { 93 {
91 m_colliderarr[i] = false; 94 m_colliderarr[i] = false;
@@ -100,7 +103,15 @@ namespace OpenSim.Region.Physics.OdePlugin
100 d.BodySetMass(Body, ref ShellMass); 103 d.BodySetMass(Body, ref ShellMass);
101 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); 104 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
102 d.GeomSetBody(Shell, Body); 105 d.GeomSetBody(Shell, Body);
103 Amotor = d.JointCreateAMotor(parent_scene.world, IntPtr.Zero); 106
107
108
109
110 d.BodySetRotation(Body, ref m_StandUpRotation);
111
112
113
114 Amotor = d.JointCreateAMotor(parent_scene.world, IntPtr.Zero);
104 d.JointAttach(Amotor, Body, IntPtr.Zero); 115 d.JointAttach(Amotor, Body, IntPtr.Zero);
105 d.JointSetAMotorMode(Amotor, dAMotorEuler); 116 d.JointSetAMotorMode(Amotor, dAMotorEuler);
106 d.JointSetAMotorNumAxes(Amotor, 3); 117 d.JointSetAMotorNumAxes(Amotor, 3);
@@ -117,6 +128,8 @@ namespace OpenSim.Region.Physics.OdePlugin
117 d.JointSetAMotorParam(Amotor, 3, 0); 128 d.JointSetAMotorParam(Amotor, 3, 0);
118 d.JointSetAMotorParam(Amotor, 2, 0); 129 d.JointSetAMotorParam(Amotor, 2, 0);
119 130
131
132
120 } 133 }
121 m_name = avName; 134 m_name = avName;
122 parent_scene.geom_name_map[Shell] = avName; 135 parent_scene.geom_name_map[Shell] = avName;
@@ -381,16 +394,21 @@ namespace OpenSim.Region.Physics.OdePlugin
381 d.BodyAddForce(Body, force.X, force.Y, force.Z); 394 d.BodyAddForce(Body, force.X, force.Y, force.Z);
382 395
383 // ok -- let's stand up straight! 396 // ok -- let's stand up straight!
384 d.Vector3 feet; 397 //d.Matrix3 StandUpRotationalMatrix = new d.Matrix3(0.8184158f, -0.5744568f, -0.0139677f, 0.5744615f, 0.8185215f, -0.004074608f, 0.01377355f, -0.004689182f, 0.9998941f);
385 d.Vector3 head; 398 //d.BodySetRotation(Body, ref StandUpRotationalMatrix);
386 d.BodyGetRelPointPos(Body, 0.0f, 0.0f, -1.0f, out feet); 399 d.BodySetRotation(Body, ref m_StandUpRotation);
387 d.BodyGetRelPointPos(Body, 0.0f, 0.0f, 1.0f, out head); 400 // The above matrix was generated with the amazing standup routine below by danX0r *cheer*
388 float posture = head.Z - feet.Z; 401 //d.Vector3 feet;
402 //d.Vector3 head;
403 //d.BodyGetRelPointPos(Body, 0.0f, 0.0f, -1.0f, out feet);
404 //d.BodyGetRelPointPos(Body, 0.0f, 0.0f, 1.0f, out head);
405 //float posture = head.Z - feet.Z;
389 406
390 // restoring force proportional to lack of posture: 407 // restoring force proportional to lack of posture:
391 float servo = (2.5f - posture) * POSTURE_SERVO; 408 //float servo = (2.5f - posture) * POSTURE_SERVO;
392 d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); 409 //d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f);
393 d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); 410 //d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f);
411
394 //m_lastUpdateSent = false; 412 //m_lastUpdateSent = false;
395 413
396 } 414 }