diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 95 |
1 files changed, 91 insertions, 4 deletions
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 | ||