avinationmerge
UbitUmarov 2012-04-27 03:36:49 +01:00
parent 76d9040ed4
commit d8f691664a
1 changed files with 72 additions and 59 deletions

View File

@ -103,6 +103,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private float m_buoyancy = 0f;
private bool m_freemove = false;
// private CollisionLocker ode;
private string m_name = String.Empty;
@ -687,6 +688,7 @@ namespace OpenSim.Region.Physics.OdePlugin
_zeroFlag = false;
m_pidControllerActive = true;
m_freemove = false;
d.BodySetAutoDisableFlag(Body, false);
d.BodySetPosition(Body, npositionX, npositionY, npositionZ);
@ -789,7 +791,7 @@ namespace OpenSim.Region.Physics.OdePlugin
qtmp.Z = 0;
d.BodySetQuaternion(Body, ref qtmp);
if (m_pidControllerActive == false)
if (m_pidControllerActive == false && !m_freemove)
{
_zeroPosition = localpos;
}
@ -861,6 +863,7 @@ namespace OpenSim.Region.Physics.OdePlugin
float terrainheight = _parent_scene.GetTerrainHeightAtXY(posch.X, posch.Y);
if (chrminZ < terrainheight)
{
m_freemove = false;
float depth = terrainheight - chrminZ;
if (!flying)
{
@ -896,9 +899,16 @@ namespace OpenSim.Region.Physics.OdePlugin
//******************************************
bool tviszero = (_target_velocity.X == 0.0f && _target_velocity.Y == 0.0f && _target_velocity.Z == 0.0f);
if(!tviszero || !m_iscolliding)
m_freemove = false;
if (!m_freemove)
{
// if velocity is zero, use position control; otherwise, velocity control
if (_target_velocity.X == 0.0f && _target_velocity.Y == 0.0f && _target_velocity.Z == 0.0f
&& m_iscolliding)
if (tviszero && m_iscolliding)
{
// keep track of where we stopped. No more slippin' & slidin'
if (!_zeroFlag)
@ -924,6 +934,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
m_freemove = false;
m_pidControllerActive = true;
_zeroFlag = false;
@ -970,6 +981,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
}
}
if (flying)
{
@ -1274,6 +1286,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{
_velocity = newmomentum;
_target_velocity = Vector3.Zero;
m_freemove = true;
m_pidControllerActive = true;
m_colliderfilter = 0;
m_colliderObjectfilter = 0;