Merge branch 'avination' into careminster

avinationmerge
Melanie 2012-05-07 12:07:42 +01:00
commit 1120a2cf36
3 changed files with 112 additions and 23 deletions

View File

@ -2276,7 +2276,8 @@ namespace OpenSim.Region.Framework.Scenes
if (pa != null) if (pa != null)
{ {
pa.AddForce(impulse, true); // false to be applied as a impulse
pa.AddForce(impulse, false);
m_scene.PhysicsScene.AddPhysicsActorTaint(pa); m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
} }
@ -2290,7 +2291,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (!IsAttachment) if (!IsAttachment)
{ {
pa.AddAngularForce(impulse, true); // false to be applied as a impulse
pa.AddAngularForce(impulse, false);
m_scene.PhysicsScene.AddPhysicsActorTaint(pa); m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
} }

View File

@ -830,6 +830,9 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (force.IsFinite()) if (force.IsFinite())
{ {
if(pushforce)
AddChange(changes.AddForce, force);
else // a impulse
AddChange(changes.AddForce, force * m_invTimeStep); AddChange(changes.AddForce, force * m_invTimeStep);
} }
else else
@ -843,7 +846,10 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (force.IsFinite()) if (force.IsFinite())
{ {
// if(pushforce) for now applyrotationimpulse seems more happy applied as a force
AddChange(changes.AddAngForce, force); AddChange(changes.AddAngForce, force);
// else // a impulse
// AddChange(changes.AddAngForce, force * m_invTimeStep);
} }
else else
{ {
@ -3375,9 +3381,12 @@ namespace OpenSim.Region.Physics.OdePlugin
d.BodyEnable(Body); d.BodyEnable(Body);
} }
// check outside region
d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator
/* moved down to UpdateMove... where it belongs again
// check outside region
if (lpos.Z < -100 || lpos.Z > 100000f) if (lpos.Z < -100 || lpos.Z > 100000f)
{ {
m_outbounds = true; m_outbounds = true;
@ -3453,7 +3462,7 @@ namespace OpenSim.Region.Physics.OdePlugin
base.RequestPhysicsterseUpdate(); base.RequestPhysicsterseUpdate();
return; return;
} }
*/
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
{ {
// 'VEHICLES' are dealt with in ODEDynamics.cs // 'VEHICLES' are dealt with in ODEDynamics.cs
@ -3507,6 +3516,7 @@ namespace OpenSim.Region.Physics.OdePlugin
fx = (_target_velocity.X - vel.X) * m_invTimeStep; fx = (_target_velocity.X - vel.X) * m_invTimeStep;
fy = (_target_velocity.Y - vel.Y) * m_invTimeStep; fy = (_target_velocity.Y - vel.Y) * m_invTimeStep;
fz = (_target_velocity.Z - vel.Z) * m_invTimeStep; fz = (_target_velocity.Z - vel.Z) * m_invTimeStep;
// d.BodySetLinearVel(Body, _target_velocity.X, _target_velocity.Y, _target_velocity.Z);
} }
} // end if (m_usePID) } // end if (m_usePID)
@ -3622,6 +3632,83 @@ namespace OpenSim.Region.Physics.OdePlugin
d.Vector3 lpos = d.GeomGetPosition(prim_geom); d.Vector3 lpos = d.GeomGetPosition(prim_geom);
// check outside region
if (lpos.Z < -100 || lpos.Z > 100000f)
{
m_outbounds = true;
lpos.Z = Util.Clip(lpos.Z, -100f, 100000f);
_acceleration.X = 0;
_acceleration.Y = 0;
_acceleration.Z = 0;
_velocity.X = 0;
_velocity.Y = 0;
_velocity.Z = 0;
m_rotationalVelocity.X = 0;
m_rotationalVelocity.Y = 0;
m_rotationalVelocity.Z = 0;
d.BodySetLinearVel(Body, 0, 0, 0); // stop it
d.BodySetAngularVel(Body, 0, 0, 0); // stop it
d.BodySetPosition(Body, lpos.X, lpos.Y, lpos.Z); // put it somewhere
m_lastposition = _position;
m_lastorientation = _orientation;
base.RequestPhysicsterseUpdate();
throttleCounter = 0;
_zeroFlag = true;
disableBodySoft(); // disable it and colisions
base.RaiseOutOfBounds(_position);
return;
}
if (lpos.X < 0f)
{
_position.X = Util.Clip(lpos.X, -2f, -0.1f);
m_outbounds = true;
}
else if (lpos.X > _parent_scene.WorldExtents.X)
{
_position.X = Util.Clip(lpos.X, _parent_scene.WorldExtents.X + 0.1f, _parent_scene.WorldExtents.X + 2f);
m_outbounds = true;
}
if (lpos.Y < 0f)
{
_position.Y = Util.Clip(lpos.Y, -2f, -0.1f);
m_outbounds = true;
}
else if (lpos.Y > _parent_scene.WorldExtents.Y)
{
_position.Y = Util.Clip(lpos.Y, _parent_scene.WorldExtents.Y + 0.1f, _parent_scene.WorldExtents.Y + 2f);
m_outbounds = true;
}
if (m_outbounds)
{
m_lastposition = _position;
m_lastorientation = _orientation;
d.Vector3 dtmp = d.BodyGetAngularVel(Body);
m_rotationalVelocity.X = dtmp.X;
m_rotationalVelocity.Y = dtmp.Y;
m_rotationalVelocity.Z = dtmp.Z;
dtmp = d.BodyGetLinearVel(Body);
_velocity.X = dtmp.X;
_velocity.Y = dtmp.Y;
_velocity.Z = dtmp.Z;
d.BodySetLinearVel(Body, 0, 0, 0); // stop it
d.BodySetAngularVel(Body, 0, 0, 0);
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
disableBodySoft(); // stop collisions
base.RequestPhysicsterseUpdate();
return;
}
d.Quaternion ori; d.Quaternion ori;
d.GeomCopyQuaternion(prim_geom, out ori); d.GeomCopyQuaternion(prim_geom, out ori);

View File

@ -178,7 +178,7 @@ namespace OpenSim.Region.Physics.OdePlugin
const float minERP = 0.1f; const float minERP = 0.1f;
const float comumContactCFM = 0.0001f; const float comumContactCFM = 0.0001f;
float frictionMovementMult = 0.3f; float frictionMovementMult = 0.8f;
float TerrainBounce = 0.1f; float TerrainBounce = 0.1f;
float TerrainFriction = 0.3f; float TerrainFriction = 0.3f;
@ -820,18 +820,18 @@ namespace OpenSim.Region.Physics.OdePlugin
switch (p2.PhysicsActorType) switch (p2.PhysicsActorType)
{ {
case (int)ActorTypes.Agent: case (int)ActorTypes.Agent:
// p1.getContactData(ref contactdata1); // p1.getContactData(ref contactdata1);
// p2.getContactData(ref contactdata2); // p2.getContactData(ref contactdata2);
bounce = 0; bounce = 0;
mu = 0; mu = 0;
cfm = 0.0001f; cfm = 0.0001f;
/* /*
mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu);
if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f)) if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f))
mu *= frictionMovementMult; mu *= frictionMovementMult;
*/ */
dop2foot = true; dop2foot = true;
if (p1.Velocity.LengthSquared() > 0.0f) if (p1.Velocity.LengthSquared() > 0.0f)
p1.CollidingObj = true; p1.CollidingObj = true;
@ -898,7 +898,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
else else
ignore=true; ignore = true;
break; break;
} }
break; break;