make some forgotten changes be done by simulation thread not by caller

avinationmerge
UbitUmarov 2012-09-27 23:14:42 +01:00
parent 285039949c
commit 58e55ae075
2 changed files with 126 additions and 34 deletions

View File

@ -161,9 +161,6 @@ namespace OpenSim.Region.Physics.OdePlugin
private List<OdePrim> childrenPrim = new List<OdePrim>(); private List<OdePrim> childrenPrim = new List<OdePrim>();
// private bool m_throttleUpdates;
// private int throttleCounter;
public float m_collisionscore; public float m_collisionscore;
private int m_colliderfilter = 0; private int m_colliderfilter = 0;
@ -175,7 +172,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private bool m_lastUpdateSent; private bool m_lastUpdateSent;
public IntPtr Body = IntPtr.Zero; public IntPtr Body = IntPtr.Zero;
// public String Name { get; private set; }
private Vector3 _target_velocity; private Vector3 _target_velocity;
public Vector3 primOOBsize; // prim real dimensions from mesh public Vector3 primOOBsize; // prim real dimensions from mesh
@ -366,12 +363,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public override bool ThrottleUpdates {get;set;} public override bool ThrottleUpdates {get;set;}
/*
{
get { return m_throttleUpdates; }
set { m_throttleUpdates = value; }
}
*/
public override bool Stopped public override bool Stopped
{ {
get { return _zeroFlag; } get { return _zeroFlag; }
@ -418,7 +410,6 @@ namespace OpenSim.Region.Physics.OdePlugin
public override Vector3 Force public override Vector3 Force
{ {
//get { return Vector3.Zero; }
get { return m_force; } get { return m_force; }
set set
{ {
@ -673,7 +664,7 @@ namespace OpenSim.Region.Physics.OdePlugin
get { return m_buoyancy; } get { return m_buoyancy; }
set set
{ {
m_buoyancy = value; AddChange(changes.Buoyancy,value);
} }
} }
@ -691,28 +682,35 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (value.IsFinite()) if (value.IsFinite())
{ {
m_PIDTarget = value; AddChange(changes.PIDTarget,value);
} }
else else
m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name);
} }
} }
public override bool PIDActive { set { m_usePID = value; } } public override bool PIDActive
{
set
{
AddChange(changes.PIDActive,value);
}
}
public override float PIDTau public override float PIDTau
{ {
set set
{ {
if (value <= 0) float tmp = 0;
m_PIDTau = 0; if (value > 0)
else
{ {
float mint = (0.05f > m_timeStep ? 0.05f : m_timeStep); float mint = (0.05f > m_timeStep ? 0.05f : m_timeStep);
if (value < mint) if (value < mint)
m_PIDTau = mint; tmp = mint;
else else
m_PIDTau = value; tmp = value;
} }
AddChange(changes.PIDTau,tmp);
} }
} }
@ -720,27 +718,39 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
set set
{ {
m_PIDHoverHeight = value; AddChange(changes.PIDHoverHeight,value);
if (value == 0)
m_useHoverPID = false;
} }
} }
public override bool PIDHoverActive { set { m_useHoverPID = value; } } public override bool PIDHoverActive
public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } {
set
{
AddChange(changes.PIDHoverActive, value);
}
}
public override PIDHoverType PIDHoverType
{
set
{
AddChange(changes.PIDHoverType,value);
}
}
public override float PIDHoverTau public override float PIDHoverTau
{ {
set set
{ {
if (value <= 0) float tmp =0;
m_PIDHoverTau = 0; if (value > 0)
else
{ {
float mint = (0.05f > m_timeStep ? 0.05f : m_timeStep); float mint = (0.05f > m_timeStep ? 0.05f : m_timeStep);
if (value < mint) if (value < mint)
m_PIDHoverTau = mint; tmp = mint;
else else
m_PIDHoverTau = value; tmp = value;
} }
AddChange(changes.PIDHoverTau, tmp);
} }
} }
@ -981,7 +991,6 @@ namespace OpenSim.Region.Physics.OdePlugin
return false; return false;
} }
public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID) Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID)
{ {
@ -3099,7 +3108,6 @@ namespace OpenSim.Region.Physics.OdePlugin
resetCollisionAccounting(); resetCollisionAccounting();
} }
private void changeDisable(bool disable) private void changeDisable(bool disable)
{ {
if (disable) if (disable)
@ -3250,7 +3258,6 @@ namespace OpenSim.Region.Physics.OdePlugin
d.BodyEnable(Body); d.BodyEnable(Body);
} }
private void changeAddForce(Vector3 theforce) private void changeAddForce(Vector3 theforce)
{ {
m_forceacc += theforce; m_forceacc += theforce;
@ -3267,7 +3274,6 @@ namespace OpenSim.Region.Physics.OdePlugin
d.BodyEnable(Body); d.BodyEnable(Body);
} }
} }
m_collisionscore = 0; m_collisionscore = 0;
} }
} }
@ -3317,7 +3323,6 @@ namespace OpenSim.Region.Physics.OdePlugin
_velocity = newVel; _velocity = newVel;
} }
private void changeangvelocity(Vector3 newAngVel) private void changeangvelocity(Vector3 newAngVel)
{ {
float len = newAngVel.LengthSquared(); float len = newAngVel.LengthSquared();
@ -3384,6 +3389,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_vehicle = new ODEDynamics(this); m_vehicle = new ODEDynamics(this);
m_vehicle.DoSetVehicle(vdata); m_vehicle.DoSetVehicle(vdata);
} }
private void changeVehicleType(int value) private void changeVehicleType(int value)
{ {
if (value == (int)Vehicle.TYPE_NONE) if (value == (int)Vehicle.TYPE_NONE)
@ -3429,6 +3435,48 @@ namespace OpenSim.Region.Physics.OdePlugin
m_vehicle.ProcessVehicleFlags(bp.param, bp.value); m_vehicle.ProcessVehicleFlags(bp.param, bp.value);
} }
private void changeBuoyancy(float b)
{
m_buoyancy = b;
}
private void changePIDTarget(Vector3 trg)
{
m_PIDTarget = trg;
}
private void changePIDTau(float tau)
{
m_PIDTau = tau;
}
private void changePIDActive(bool val)
{
m_usePID = val;
}
private void changePIDHoverHeight(float val)
{
m_PIDHoverHeight = val;
if (val == 0)
m_useHoverPID = false;
}
private void changePIDHoverType(PIDHoverType type)
{
m_PIDHoverType = type;
}
private void changePIDHoverTau(float tau)
{
m_PIDHoverTau = tau;
}
private void changePIDHoverActive(bool active)
{
m_useHoverPID = active;
}
#endregion #endregion
public void Move() public void Move()
@ -3987,6 +4035,39 @@ namespace OpenSim.Region.Physics.OdePlugin
case changes.SetVehicle: case changes.SetVehicle:
changeSetVehicle((VehicleData) arg); changeSetVehicle((VehicleData) arg);
break; break;
case changes.Buoyancy:
changeBuoyancy((float)arg);
break;
case changes.PIDTarget:
changePIDTarget((Vector3)arg);
break;
case changes.PIDTau:
changePIDTau((float)arg);
break;
case changes.PIDActive:
changePIDActive((bool)arg);
break;
case changes.PIDHoverHeight:
changePIDHoverHeight((float)arg);
break;
case changes.PIDHoverType:
changePIDHoverType((PIDHoverType)arg);
break;
case changes.PIDHoverTau:
changePIDHoverTau((float)arg);
break;
case changes.PIDHoverActive:
changePIDHoverActive((bool)arg);
break;
case changes.Null: case changes.Null:
donullchange(); donullchange();
break; break;

View File

@ -134,6 +134,17 @@ namespace OpenSim.Region.Physics.OdePlugin
AddAngForce, AddAngForce,
AngLock, AngLock,
Buoyancy,
PIDTarget,
PIDTau,
PIDActive,
PIDHoverHeight,
PIDHoverType,
PIDHoverTau,
PIDHoverActive,
Size, Size,
Shape, Shape,