diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 0d8eeec..bf0400b 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | |||
@@ -85,7 +85,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
85 | private Vector3 m_lastposition; | 85 | private Vector3 m_lastposition; |
86 | private Vector3 m_rotationalVelocity; | 86 | private Vector3 m_rotationalVelocity; |
87 | private Vector3 _size; | 87 | private Vector3 _size; |
88 | private Vector3 _acceleration; | 88 | private Vector3 m_acceleration; |
89 | private IntPtr Amotor; | 89 | private IntPtr Amotor; |
90 | 90 | ||
91 | internal Vector3 m_force; | 91 | internal Vector3 m_force; |
@@ -746,8 +746,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
746 | 746 | ||
747 | public override Vector3 Acceleration | 747 | public override Vector3 Acceleration |
748 | { | 748 | { |
749 | get { return _acceleration; } | 749 | get { return m_acceleration; } |
750 | set { } | 750 | set |
751 | { | ||
752 | if(m_outbounds) | ||
753 | m_acceleration = value; | ||
754 | } | ||
751 | } | 755 | } |
752 | 756 | ||
753 | public override Vector3 RotationalVelocity | 757 | public override Vector3 RotationalVelocity |
@@ -767,7 +771,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
767 | { | 771 | { |
768 | if (value.IsFinite()) | 772 | if (value.IsFinite()) |
769 | { | 773 | { |
770 | AddChange(changes.AngVelocity, value); | 774 | if(m_outbounds) |
775 | m_rotationalVelocity = value; | ||
776 | else | ||
777 | AddChange(changes.AngVelocity, value); | ||
771 | } | 778 | } |
772 | else | 779 | else |
773 | { | 780 | { |
@@ -941,7 +948,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
941 | } | 948 | } |
942 | public void SetAcceleration(Vector3 accel) | 949 | public void SetAcceleration(Vector3 accel) |
943 | { | 950 | { |
944 | _acceleration = accel; | 951 | m_acceleration = accel; |
945 | } | 952 | } |
946 | 953 | ||
947 | public override void AddForce(Vector3 force, bool pushforce) | 954 | public override void AddForce(Vector3 force, bool pushforce) |
@@ -2748,7 +2755,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2748 | m_angularForceacc = Vector3.Zero; | 2755 | m_angularForceacc = Vector3.Zero; |
2749 | // m_torque = Vector3.Zero; | 2756 | // m_torque = Vector3.Zero; |
2750 | _velocity = Vector3.Zero; | 2757 | _velocity = Vector3.Zero; |
2751 | _acceleration = Vector3.Zero; | 2758 | m_acceleration = Vector3.Zero; |
2752 | m_rotationalVelocity = Vector3.Zero; | 2759 | m_rotationalVelocity = Vector3.Zero; |
2753 | _target_velocity = Vector3.Zero; | 2760 | _target_velocity = Vector3.Zero; |
2754 | if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) | 2761 | if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) |
@@ -3784,9 +3791,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3784 | m_outbounds = true; | 3791 | m_outbounds = true; |
3785 | 3792 | ||
3786 | lpos.Z = Util.Clip(lpos.Z, -100f, 100000f); | 3793 | lpos.Z = Util.Clip(lpos.Z, -100f, 100000f); |
3787 | _acceleration.X = 0; | 3794 | m_acceleration.X = 0; |
3788 | _acceleration.Y = 0; | 3795 | m_acceleration.Y = 0; |
3789 | _acceleration.Z = 0; | 3796 | m_acceleration.Z = 0; |
3790 | 3797 | ||
3791 | _velocity.X = 0; | 3798 | _velocity.X = 0; |
3792 | _velocity.Y = 0; | 3799 | _velocity.Y = 0; |
@@ -3915,12 +3922,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3915 | _orientation.W = ori.W; | 3922 | _orientation.W = ori.W; |
3916 | } | 3923 | } |
3917 | 3924 | ||
3918 | // update velocities and aceleration | 3925 | // update velocities and acceleration |
3919 | if (_zeroFlag || lastZeroFlag) | 3926 | if (_zeroFlag || lastZeroFlag) |
3920 | { | 3927 | { |
3921 | // disable interpolators | 3928 | // disable interpolators |
3922 | _velocity = Vector3.Zero; | 3929 | _velocity = Vector3.Zero; |
3923 | _acceleration = Vector3.Zero; | 3930 | m_acceleration = Vector3.Zero; |
3924 | m_rotationalVelocity = Vector3.Zero; | 3931 | m_rotationalVelocity = Vector3.Zero; |
3925 | } | 3932 | } |
3926 | else | 3933 | else |
@@ -3929,7 +3936,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3929 | { | 3936 | { |
3930 | d.Vector3 vel = d.BodyGetLinearVel(Body); | 3937 | d.Vector3 vel = d.BodyGetLinearVel(Body); |
3931 | 3938 | ||
3932 | _acceleration = _velocity; | 3939 | m_acceleration = _velocity; |
3933 | 3940 | ||
3934 | if ((Math.Abs(vel.X) < 0.005f) && | 3941 | if ((Math.Abs(vel.X) < 0.005f) && |
3935 | (Math.Abs(vel.Y) < 0.005f) && | 3942 | (Math.Abs(vel.Y) < 0.005f) && |
@@ -3937,21 +3944,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3937 | { | 3944 | { |
3938 | _velocity = Vector3.Zero; | 3945 | _velocity = Vector3.Zero; |
3939 | float t = -m_invTimeStep; | 3946 | float t = -m_invTimeStep; |
3940 | _acceleration = _acceleration * t; | 3947 | m_acceleration = m_acceleration * t; |
3941 | } | 3948 | } |
3942 | else | 3949 | else |
3943 | { | 3950 | { |
3944 | _velocity.X = vel.X; | 3951 | _velocity.X = vel.X; |
3945 | _velocity.Y = vel.Y; | 3952 | _velocity.Y = vel.Y; |
3946 | _velocity.Z = vel.Z; | 3953 | _velocity.Z = vel.Z; |
3947 | _acceleration = (_velocity - _acceleration) * m_invTimeStep; | 3954 | m_acceleration = (_velocity - m_acceleration) * m_invTimeStep; |
3948 | } | 3955 | } |
3949 | 3956 | ||
3950 | if ((Math.Abs(_acceleration.X) < 0.01f) && | 3957 | if ((Math.Abs(m_acceleration.X) < 0.01f) && |
3951 | (Math.Abs(_acceleration.Y) < 0.01f) && | 3958 | (Math.Abs(m_acceleration.Y) < 0.01f) && |
3952 | (Math.Abs(_acceleration.Z) < 0.01f)) | 3959 | (Math.Abs(m_acceleration.Z) < 0.01f)) |
3953 | { | 3960 | { |
3954 | _acceleration = Vector3.Zero; | 3961 | m_acceleration = Vector3.Zero; |
3955 | } | 3962 | } |
3956 | 3963 | ||
3957 | vel = d.BodyGetAngularVel(Body); | 3964 | vel = d.BodyGetAngularVel(Body); |