aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
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
parent* Added a -val heightfield value limiter so giant pits of death don't cause a... (diff)
downloadopensim-SC_OLD-0e460a81cc7e1c9eb4b5576f78e78400f05cf48a.zip
opensim-SC_OLD-0e460a81cc7e1c9eb4b5576f78e78400f05cf48a.tar.gz
opensim-SC_OLD-0e460a81cc7e1c9eb4b5576f78e78400f05cf48a.tar.bz2
opensim-SC_OLD-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')
-rw-r--r--OpenSim/Region/ClientStack/UDPServer.cs39
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs36
2 files changed, 48 insertions, 27 deletions
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs
index 3455b5a..a8a1ff6 100644
--- a/OpenSim/Region/ClientStack/UDPServer.cs
+++ b/OpenSim/Region/ClientStack/UDPServer.cs
@@ -293,26 +293,29 @@ namespace OpenSim.Region.ClientStack
293 //MainLog.Instance.Debug("UDPSERVER", e.ToString()); 293 //MainLog.Instance.Debug("UDPSERVER", e.ToString());
294 } 294 }
295 295
296 // do we already have a circuit for this endpoint 296 if (packet != null)
297 uint circuit;
298 if (clientCircuits.TryGetValue(epSender, out circuit))
299 {
300 //if so then send packet to the packetserver
301 //MainLog.Instance.Warn("UDPSERVER", "ALREADY HAVE Circuit!");
302 m_packetServer.InPacket(circuit, packet);
303 }
304 else if (packet.Type == PacketType.UseCircuitCode)
305 {
306 // new client
307 MainLog.Instance.Debug("UDPSERVER", "Adding New Client");
308 AddNewClient(packet);
309 }
310 else
311 { 297 {
298 // do we already have a circuit for this endpoint
299 uint circuit;
300 if (clientCircuits.TryGetValue(epSender, out circuit))
301 {
302 //if so then send packet to the packetserver
303 //MainLog.Instance.Warn("UDPSERVER", "ALREADY HAVE Circuit!");
304 m_packetServer.InPacket(circuit, packet);
305 }
306 else if (packet.Type == PacketType.UseCircuitCode)
307 {
308 // new client
309 MainLog.Instance.Debug("UDPSERVER", "Adding New Client");
310 AddNewClient(packet);
311 }
312 else
313 {
312 314
313 // invalid client 315 // invalid client
314 //CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now 316 //CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now
315 //m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString()); 317 //m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString());
318 }
316 } 319 }
317 320
318 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 321 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
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 }