* 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,6 +293,8 @@ namespace OpenSim.Region.ClientStack
//MainLog.Instance.Debug("UDPSERVER", e.ToString());
}
if (packet != null)
{
// do we already have a circuit for this endpoint
uint circuit;
if (clientCircuits.TryGetValue(epSender, out circuit))
@ -314,6 +316,7 @@ namespace OpenSim.Region.ClientStack
//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());
}
}
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 d.Vector3 _zeroPosition;
private d.Matrix3 m_StandUpRotation;
private bool _zeroFlag = false;
private bool m_lastUpdateSent = false;
private PhysicsVector _velocity;
@ -86,6 +87,8 @@ namespace OpenSim.Region.Physics.OdePlugin
_acceleration = new PhysicsVector();
_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++)
{
m_colliderarr[i] = false;
@ -100,6 +103,14 @@ namespace OpenSim.Region.Physics.OdePlugin
d.BodySetMass(Body, ref ShellMass);
d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
d.GeomSetBody(Shell, Body);
d.BodySetRotation(Body, ref m_StandUpRotation);
Amotor = d.JointCreateAMotor(parent_scene.world, IntPtr.Zero);
d.JointAttach(Amotor, Body, IntPtr.Zero);
d.JointSetAMotorMode(Amotor, dAMotorEuler);
@ -117,6 +128,8 @@ namespace OpenSim.Region.Physics.OdePlugin
d.JointSetAMotorParam(Amotor, 3, 0);
d.JointSetAMotorParam(Amotor, 2, 0);
}
m_name = 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);
// ok -- let's stand up straight!
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;
//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.BodySetRotation(Body, ref StandUpRotationalMatrix);
d.BodySetRotation(Body, ref m_StandUpRotation);
// The above matrix was generated with the amazing standup routine below by danX0r *cheer*
//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:
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);
//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);
//m_lastUpdateSent = false;
}