diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 68 |
1 files changed, 49 insertions, 19 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 9b3b51b..ff17a6e 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -275,6 +275,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
275 | 275 | ||
276 | if (veh != null && veh.Type != Vehicle.TYPE_NONE) | 276 | if (veh != null && veh.Type != Vehicle.TYPE_NONE) |
277 | cdata.mu *= veh.FrictionFactor; | 277 | cdata.mu *= veh.FrictionFactor; |
278 | // cdata.mu *= 0; | ||
278 | } | 279 | } |
279 | } | 280 | } |
280 | 281 | ||
@@ -582,8 +583,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
582 | if (value.IsFinite()) | 583 | if (value.IsFinite()) |
583 | { | 584 | { |
584 | AddChange(changes.Velocity, value); | 585 | AddChange(changes.Velocity, value); |
585 | // _velocity = value; | ||
586 | |||
587 | } | 586 | } |
588 | else | 587 | else |
589 | { | 588 | { |
@@ -675,9 +674,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
675 | { | 674 | { |
676 | if (value.IsFinite()) | 675 | if (value.IsFinite()) |
677 | { | 676 | { |
678 | m_rotationalVelocity = value; | 677 | AddChange(changes.AngVelocity, value); |
679 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | ||
680 | d.BodyEnable(Body); | ||
681 | } | 678 | } |
682 | else | 679 | else |
683 | { | 680 | { |
@@ -686,7 +683,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
686 | } | 683 | } |
687 | } | 684 | } |
688 | 685 | ||
689 | |||
690 | public override float Buoyancy | 686 | public override float Buoyancy |
691 | { | 687 | { |
692 | get { return m_buoyancy; } | 688 | get { return m_buoyancy; } |
@@ -947,6 +943,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
947 | CollisionEventsThisFrame = null; | 943 | CollisionEventsThisFrame = null; |
948 | } | 944 | } |
949 | m_eventsubscription = 0; | 945 | m_eventsubscription = 0; |
946 | // for now still done on odescene | ||
947 | // _parent_scene.RemoveCollisionEventReporting(this); | ||
950 | } | 948 | } |
951 | 949 | ||
952 | public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) | 950 | public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) |
@@ -1736,17 +1734,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1736 | 1734 | ||
1737 | d.BodySetAutoDisableFlag(Body, true); | 1735 | d.BodySetAutoDisableFlag(Body, true); |
1738 | d.BodySetAutoDisableSteps(Body, body_autodisable_frames); | 1736 | d.BodySetAutoDisableSteps(Body, body_autodisable_frames); |
1739 | // d.BodySetLinearDampingThreshold(Body, 0.01f); | 1737 | d.BodySetDamping(Body, .005f, .005f); |
1740 | // d.BodySetAngularDampingThreshold(Body, 0.001f); | ||
1741 | d.BodySetDamping(Body, .002f, .002f); | ||
1742 | |||
1743 | if (m_targetSpace != IntPtr.Zero) | ||
1744 | { | ||
1745 | _parent_scene.waitForSpaceUnlock(m_targetSpace); | ||
1746 | if (d.SpaceQuery(m_targetSpace, prim_geom)) | ||
1747 | d.SpaceRemove(m_targetSpace, prim_geom); | ||
1748 | } | ||
1749 | 1738 | ||
1739 | if (m_targetSpace != IntPtr.Zero) | ||
1740 | { | ||
1741 | _parent_scene.waitForSpaceUnlock(m_targetSpace); | ||
1742 | if (d.SpaceQuery(m_targetSpace, prim_geom)) | ||
1743 | d.SpaceRemove(m_targetSpace, prim_geom); | ||
1744 | } | ||
1750 | 1745 | ||
1751 | if (childrenPrim.Count == 0) | 1746 | if (childrenPrim.Count == 0) |
1752 | { | 1747 | { |
@@ -3295,6 +3290,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3295 | 3290 | ||
3296 | private void changevelocity(Vector3 newVel) | 3291 | private void changevelocity(Vector3 newVel) |
3297 | { | 3292 | { |
3293 | float len = newVel.LengthSquared(); | ||
3294 | if (len > 100000.0f) // limit to 100m/s | ||
3295 | { | ||
3296 | len = 100.0f / (float)Math.Sqrt(len); | ||
3297 | newVel *= len; | ||
3298 | } | ||
3299 | |||
3298 | if (!m_isSelected) | 3300 | if (!m_isSelected) |
3299 | { | 3301 | { |
3300 | if (Body != IntPtr.Zero) | 3302 | if (Body != IntPtr.Zero) |
@@ -3311,6 +3313,33 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3311 | _velocity = newVel; | 3313 | _velocity = newVel; |
3312 | } | 3314 | } |
3313 | 3315 | ||
3316 | |||
3317 | private void changeangvelocity(Vector3 newAngVel) | ||
3318 | { | ||
3319 | float len = newAngVel.LengthSquared(); | ||
3320 | if (len > 144.0f) // limit to 12rad/s | ||
3321 | { | ||
3322 | len = 12.0f / (float)Math.Sqrt(len); | ||
3323 | newAngVel *= len; | ||
3324 | } | ||
3325 | |||
3326 | if (!m_isSelected) | ||
3327 | { | ||
3328 | if (Body != IntPtr.Zero) | ||
3329 | { | ||
3330 | if (m_disabled) | ||
3331 | enableBodySoft(); | ||
3332 | else if (!d.BodyIsEnabled(Body)) | ||
3333 | d.BodyEnable(Body); | ||
3334 | |||
3335 | |||
3336 | d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z); | ||
3337 | } | ||
3338 | //resetCollisionAccounting(); | ||
3339 | } | ||
3340 | m_rotationalVelocity = newAngVel; | ||
3341 | } | ||
3342 | |||
3314 | private void changeVolumedetetion(bool newVolDtc) | 3343 | private void changeVolumedetetion(bool newVolDtc) |
3315 | { | 3344 | { |
3316 | m_isVolumeDetect = newVolDtc; | 3345 | m_isVolumeDetect = newVolDtc; |
@@ -3947,9 +3976,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3947 | // case changes.Acceleration: | 3976 | // case changes.Acceleration: |
3948 | // changeacceleration((Vector3)arg); | 3977 | // changeacceleration((Vector3)arg); |
3949 | // break; | 3978 | // break; |
3950 | // case changes.AngVelocity: | 3979 | |
3951 | // changeangvelocity((Vector3)arg); | 3980 | case changes.AngVelocity: |
3952 | // break; | 3981 | changeangvelocity((Vector3)arg); |
3982 | break; | ||
3953 | 3983 | ||
3954 | case changes.Force: | 3984 | case changes.Force: |
3955 | changeForce((Vector3)arg); | 3985 | changeForce((Vector3)arg); |