* Coded around another Null packet sent by the packet pool

* Condensed 8 calls to unmanaged code in ODE down to 1
afrisby
Teravus Ovares 2007-12-26 04:23:36 +00:00
parent 2259bc8ebf
commit 0e460a81cc
2 changed files with 48 additions and 27 deletions

View File

@ -293,26 +293,29 @@ namespace OpenSim.Region.ClientStack
//MainLog.Instance.Debug("UDPSERVER", e.ToString()); //MainLog.Instance.Debug("UDPSERVER", e.ToString());
} }
// do we already have a circuit for this endpoint if (packet != null)
uint circuit;
if (clientCircuits.TryGetValue(epSender, out circuit))
{
//if so then send packet to the packetserver
//MainLog.Instance.Warn("UDPSERVER", "ALREADY HAVE Circuit!");
m_packetServer.InPacket(circuit, packet);
}
else if (packet.Type == PacketType.UseCircuitCode)
{
// new client
MainLog.Instance.Debug("UDPSERVER", "Adding New Client");
AddNewClient(packet);
}
else
{ {
// do we already have a circuit for this endpoint
uint circuit;
if (clientCircuits.TryGetValue(epSender, out circuit))
{
//if so then send packet to the packetserver
//MainLog.Instance.Warn("UDPSERVER", "ALREADY HAVE Circuit!");
m_packetServer.InPacket(circuit, packet);
}
else if (packet.Type == PacketType.UseCircuitCode)
{
// new client
MainLog.Instance.Debug("UDPSERVER", "Adding New Client");
AddNewClient(packet);
}
else
{
// invalid client // invalid client
//CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now //CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now
//m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString()); //m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString());
}
} }
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);

View File

@ -40,6 +40,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
private PhysicsVector _position; private PhysicsVector _position;
private d.Vector3 _zeroPosition; private d.Vector3 _zeroPosition;
private d.Matrix3 m_StandUpRotation;
private bool _zeroFlag = false; private bool _zeroFlag = false;
private bool m_lastUpdateSent = false; private bool m_lastUpdateSent = false;
private PhysicsVector _velocity; private PhysicsVector _velocity;
@ -86,6 +87,8 @@ namespace OpenSim.Region.Physics.OdePlugin
_acceleration = new PhysicsVector(); _acceleration = new PhysicsVector();
_parent_scene = parent_scene; _parent_scene = parent_scene;
m_StandUpRotation = new d.Matrix3(0.8184158f, -0.5744568f, -0.0139677f, 0.5744615f, 0.8185215f, -0.004074608f, 0.01377355f, -0.004689182f, 0.9998941f);
for (int i = 0; i < 11; i++) for (int i = 0; i < 11; i++)
{ {
m_colliderarr[i] = false; m_colliderarr[i] = false;
@ -100,7 +103,15 @@ namespace OpenSim.Region.Physics.OdePlugin
d.BodySetMass(Body, ref ShellMass); d.BodySetMass(Body, ref ShellMass);
d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
d.GeomSetBody(Shell, Body); d.GeomSetBody(Shell, Body);
Amotor = d.JointCreateAMotor(parent_scene.world, IntPtr.Zero);
d.BodySetRotation(Body, ref m_StandUpRotation);
Amotor = d.JointCreateAMotor(parent_scene.world, IntPtr.Zero);
d.JointAttach(Amotor, Body, IntPtr.Zero); d.JointAttach(Amotor, Body, IntPtr.Zero);
d.JointSetAMotorMode(Amotor, dAMotorEuler); d.JointSetAMotorMode(Amotor, dAMotorEuler);
d.JointSetAMotorNumAxes(Amotor, 3); d.JointSetAMotorNumAxes(Amotor, 3);
@ -117,6 +128,8 @@ namespace OpenSim.Region.Physics.OdePlugin
d.JointSetAMotorParam(Amotor, 3, 0); d.JointSetAMotorParam(Amotor, 3, 0);
d.JointSetAMotorParam(Amotor, 2, 0); d.JointSetAMotorParam(Amotor, 2, 0);
} }
m_name = avName; m_name = avName;
parent_scene.geom_name_map[Shell] = avName; parent_scene.geom_name_map[Shell] = avName;
@ -381,16 +394,21 @@ namespace OpenSim.Region.Physics.OdePlugin
d.BodyAddForce(Body, force.X, force.Y, force.Z); d.BodyAddForce(Body, force.X, force.Y, force.Z);
// ok -- let's stand up straight! // ok -- let's stand up straight!
d.Vector3 feet; //d.Matrix3 StandUpRotationalMatrix = new d.Matrix3(0.8184158f, -0.5744568f, -0.0139677f, 0.5744615f, 0.8185215f, -0.004074608f, 0.01377355f, -0.004689182f, 0.9998941f);
d.Vector3 head; //d.BodySetRotation(Body, ref StandUpRotationalMatrix);
d.BodyGetRelPointPos(Body, 0.0f, 0.0f, -1.0f, out feet); d.BodySetRotation(Body, ref m_StandUpRotation);
d.BodyGetRelPointPos(Body, 0.0f, 0.0f, 1.0f, out head); // The above matrix was generated with the amazing standup routine below by danX0r *cheer*
float posture = head.Z - feet.Z; //d.Vector3 feet;
//d.Vector3 head;
//d.BodyGetRelPointPos(Body, 0.0f, 0.0f, -1.0f, out feet);
//d.BodyGetRelPointPos(Body, 0.0f, 0.0f, 1.0f, out head);
//float posture = head.Z - feet.Z;
// restoring force proportional to lack of posture: // restoring force proportional to lack of posture:
float servo = (2.5f - posture) * POSTURE_SERVO; //float servo = (2.5f - posture) * POSTURE_SERVO;
d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); //d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f);
d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); //d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f);
//m_lastUpdateSent = false; //m_lastUpdateSent = false;
} }