aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs6
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs95
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs34
3 files changed, 112 insertions, 23 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index a6ce0e2..468c7ea 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2276,7 +2276,8 @@ namespace OpenSim.Region.Framework.Scenes
2276 2276
2277 if (pa != null) 2277 if (pa != null)
2278 { 2278 {
2279 pa.AddForce(impulse, true); 2279 // false to be applied as a impulse
2280 pa.AddForce(impulse, false);
2280 m_scene.PhysicsScene.AddPhysicsActorTaint(pa); 2281 m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
2281 } 2282 }
2282 } 2283 }
@@ -2290,7 +2291,8 @@ namespace OpenSim.Region.Framework.Scenes
2290 { 2291 {
2291 if (!IsAttachment) 2292 if (!IsAttachment)
2292 { 2293 {
2293 pa.AddAngularForce(impulse, true); 2294 // false to be applied as a impulse
2295 pa.AddAngularForce(impulse, false);
2294 m_scene.PhysicsScene.AddPhysicsActorTaint(pa); 2296 m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
2295 } 2297 }
2296 } 2298 }
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index e4f2e6b..87a7e51 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -830,7 +830,10 @@ namespace OpenSim.Region.Physics.OdePlugin
830 { 830 {
831 if (force.IsFinite()) 831 if (force.IsFinite())
832 { 832 {
833 AddChange(changes.AddForce, force * m_invTimeStep); 833 if(pushforce)
834 AddChange(changes.AddForce, force);
835 else // a impulse
836 AddChange(changes.AddForce, force * m_invTimeStep);
834 } 837 }
835 else 838 else
836 { 839 {
@@ -843,7 +846,10 @@ namespace OpenSim.Region.Physics.OdePlugin
843 { 846 {
844 if (force.IsFinite()) 847 if (force.IsFinite())
845 { 848 {
846 AddChange(changes.AddAngForce, force); 849// if(pushforce) for now applyrotationimpulse seems more happy applied as a force
850 AddChange(changes.AddAngForce, force);
851// else // a impulse
852// AddChange(changes.AddAngForce, force * m_invTimeStep);
847 } 853 }
848 else 854 else
849 { 855 {
@@ -3375,9 +3381,12 @@ namespace OpenSim.Region.Physics.OdePlugin
3375 d.BodyEnable(Body); 3381 d.BodyEnable(Body);
3376 } 3382 }
3377 3383
3378 // check outside region
3379 d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator 3384 d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator
3380 3385
3386/* moved down to UpdateMove... where it belongs again
3387
3388 // check outside region
3389
3381 if (lpos.Z < -100 || lpos.Z > 100000f) 3390 if (lpos.Z < -100 || lpos.Z > 100000f)
3382 { 3391 {
3383 m_outbounds = true; 3392 m_outbounds = true;
@@ -3453,7 +3462,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3453 base.RequestPhysicsterseUpdate(); 3462 base.RequestPhysicsterseUpdate();
3454 return; 3463 return;
3455 } 3464 }
3456 3465*/
3457 if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) 3466 if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
3458 { 3467 {
3459 // 'VEHICLES' are dealt with in ODEDynamics.cs 3468 // 'VEHICLES' are dealt with in ODEDynamics.cs
@@ -3507,6 +3516,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3507 fx = (_target_velocity.X - vel.X) * m_invTimeStep; 3516 fx = (_target_velocity.X - vel.X) * m_invTimeStep;
3508 fy = (_target_velocity.Y - vel.Y) * m_invTimeStep; 3517 fy = (_target_velocity.Y - vel.Y) * m_invTimeStep;
3509 fz = (_target_velocity.Z - vel.Z) * m_invTimeStep; 3518 fz = (_target_velocity.Z - vel.Z) * m_invTimeStep;
3519// d.BodySetLinearVel(Body, _target_velocity.X, _target_velocity.Y, _target_velocity.Z);
3510 } 3520 }
3511 } // end if (m_usePID) 3521 } // end if (m_usePID)
3512 3522
@@ -3622,6 +3632,83 @@ namespace OpenSim.Region.Physics.OdePlugin
3622 3632
3623 d.Vector3 lpos = d.GeomGetPosition(prim_geom); 3633 d.Vector3 lpos = d.GeomGetPosition(prim_geom);
3624 3634
3635 // check outside region
3636 if (lpos.Z < -100 || lpos.Z > 100000f)
3637 {
3638 m_outbounds = true;
3639
3640 lpos.Z = Util.Clip(lpos.Z, -100f, 100000f);
3641 _acceleration.X = 0;
3642 _acceleration.Y = 0;
3643 _acceleration.Z = 0;
3644
3645 _velocity.X = 0;
3646 _velocity.Y = 0;
3647 _velocity.Z = 0;
3648 m_rotationalVelocity.X = 0;
3649 m_rotationalVelocity.Y = 0;
3650 m_rotationalVelocity.Z = 0;
3651
3652 d.BodySetLinearVel(Body, 0, 0, 0); // stop it
3653 d.BodySetAngularVel(Body, 0, 0, 0); // stop it
3654 d.BodySetPosition(Body, lpos.X, lpos.Y, lpos.Z); // put it somewhere
3655 m_lastposition = _position;
3656 m_lastorientation = _orientation;
3657
3658 base.RequestPhysicsterseUpdate();
3659
3660 throttleCounter = 0;
3661 _zeroFlag = true;
3662
3663 disableBodySoft(); // disable it and colisions
3664 base.RaiseOutOfBounds(_position);
3665 return;
3666 }
3667
3668 if (lpos.X < 0f)
3669 {
3670 _position.X = Util.Clip(lpos.X, -2f, -0.1f);
3671 m_outbounds = true;
3672 }
3673 else if (lpos.X > _parent_scene.WorldExtents.X)
3674 {
3675 _position.X = Util.Clip(lpos.X, _parent_scene.WorldExtents.X + 0.1f, _parent_scene.WorldExtents.X + 2f);
3676 m_outbounds = true;
3677 }
3678 if (lpos.Y < 0f)
3679 {
3680 _position.Y = Util.Clip(lpos.Y, -2f, -0.1f);
3681 m_outbounds = true;
3682 }
3683 else if (lpos.Y > _parent_scene.WorldExtents.Y)
3684 {
3685 _position.Y = Util.Clip(lpos.Y, _parent_scene.WorldExtents.Y + 0.1f, _parent_scene.WorldExtents.Y + 2f);
3686 m_outbounds = true;
3687 }
3688
3689 if (m_outbounds)
3690 {
3691 m_lastposition = _position;
3692 m_lastorientation = _orientation;
3693
3694 d.Vector3 dtmp = d.BodyGetAngularVel(Body);
3695 m_rotationalVelocity.X = dtmp.X;
3696 m_rotationalVelocity.Y = dtmp.Y;
3697 m_rotationalVelocity.Z = dtmp.Z;
3698
3699 dtmp = d.BodyGetLinearVel(Body);
3700 _velocity.X = dtmp.X;
3701 _velocity.Y = dtmp.Y;
3702 _velocity.Z = dtmp.Z;
3703
3704 d.BodySetLinearVel(Body, 0, 0, 0); // stop it
3705 d.BodySetAngularVel(Body, 0, 0, 0);
3706 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
3707 disableBodySoft(); // stop collisions
3708 base.RequestPhysicsterseUpdate();
3709 return;
3710 }
3711
3625 d.Quaternion ori; 3712 d.Quaternion ori;
3626 d.GeomCopyQuaternion(prim_geom, out ori); 3713 d.GeomCopyQuaternion(prim_geom, out ori);
3627 3714
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 84195d3..ca83dd7 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -178,7 +178,7 @@ namespace OpenSim.Region.Physics.OdePlugin
178 const float minERP = 0.1f; 178 const float minERP = 0.1f;
179 const float comumContactCFM = 0.0001f; 179 const float comumContactCFM = 0.0001f;
180 180
181 float frictionMovementMult = 0.3f; 181 float frictionMovementMult = 0.8f;
182 182
183 float TerrainBounce = 0.1f; 183 float TerrainBounce = 0.1f;
184 float TerrainFriction = 0.3f; 184 float TerrainFriction = 0.3f;
@@ -820,18 +820,18 @@ namespace OpenSim.Region.Physics.OdePlugin
820 switch (p2.PhysicsActorType) 820 switch (p2.PhysicsActorType)
821 { 821 {
822 case (int)ActorTypes.Agent: 822 case (int)ActorTypes.Agent:
823// p1.getContactData(ref contactdata1); 823 // p1.getContactData(ref contactdata1);
824// p2.getContactData(ref contactdata2); 824 // p2.getContactData(ref contactdata2);
825 825
826 bounce = 0; 826 bounce = 0;
827 mu = 0; 827 mu = 0;
828 cfm = 0.0001f; 828 cfm = 0.0001f;
829/* 829 /*
830 mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); 830 mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu);
831 831
832 if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f)) 832 if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f))
833 mu *= frictionMovementMult; 833 mu *= frictionMovementMult;
834*/ 834 */
835 dop2foot = true; 835 dop2foot = true;
836 if (p1.Velocity.LengthSquared() > 0.0f) 836 if (p1.Velocity.LengthSquared() > 0.0f)
837 p1.CollidingObj = true; 837 p1.CollidingObj = true;
@@ -850,14 +850,14 @@ namespace OpenSim.Region.Physics.OdePlugin
850 cfm = p1.Mass; 850 cfm = p1.Mass;
851 if (cfm > p2.Mass) 851 if (cfm > p2.Mass)
852 cfm = p2.Mass; 852 cfm = p2.Mass;
853 dscale = 10 / cfm; 853 dscale = 10 / cfm;
854 dscale = (float)Math.Sqrt(dscale); 854 dscale = (float)Math.Sqrt(dscale);
855 if (dscale > 1.0f) 855 if (dscale > 1.0f)
856 dscale = 1.0f; 856 dscale = 1.0f;
857 erpscale = cfm * 0.01f; 857 erpscale = cfm * 0.01f;
858 cfm = 0.0001f / cfm; 858 cfm = 0.0001f / cfm;
859 if (cfm > 0.01f) 859 if (cfm > 0.01f)
860 cfm = 0.01f; 860 cfm = 0.01f;
861 861
862 if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f)) 862 if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f))
863 mu *= frictionMovementMult; 863 mu *= frictionMovementMult;
@@ -898,7 +898,7 @@ namespace OpenSim.Region.Physics.OdePlugin
898 } 898 }
899 } 899 }
900 else 900 else
901 ignore=true; 901 ignore = true;
902 break; 902 break;
903 } 903 }
904 break; 904 break;