diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 4bed0d2..76ef88b 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | |||
@@ -1043,7 +1043,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1043 | d.BodySetLinearVel(Body, 0, 0, 0); // stop it | 1043 | d.BodySetLinearVel(Body, 0, 0, 0); // stop it |
1044 | d.BodySetAngularVel(Body, 0, 0, 0); | 1044 | d.BodySetAngularVel(Body, 0, 0, 0); |
1045 | } | 1045 | } |
1046 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1046 | if(prim_geom != IntPtr.Zero) |
1047 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | ||
1047 | disableBodySoft(); // stop collisions | 1048 | disableBodySoft(); // stop collisions |
1048 | UnSubscribeEvents(); | 1049 | UnSubscribeEvents(); |
1049 | } | 1050 | } |
@@ -1240,7 +1241,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1240 | SentEmptyCollisionsEvent = true; | 1241 | SentEmptyCollisionsEvent = true; |
1241 | // _parent_scene.RemoveCollisionEventReporting(this); | 1242 | // _parent_scene.RemoveCollisionEventReporting(this); |
1242 | } | 1243 | } |
1243 | else if(Body == IntPtr.Zero || d.BodyIsEnabled(Body)) | 1244 | else if(Body == IntPtr.Zero || (d.BodyIsEnabled(Body) && m_bodydisablecontrol >= 0 )) |
1244 | { | 1245 | { |
1245 | SentEmptyCollisionsEvent = false; | 1246 | SentEmptyCollisionsEvent = false; |
1246 | CollisionEventsThisFrame.Clear(); | 1247 | CollisionEventsThisFrame.Clear(); |
@@ -1847,8 +1848,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1847 | ApplyCollisionCatFlags(); | 1848 | ApplyCollisionCatFlags(); |
1848 | 1849 | ||
1849 | _zeroFlag = true; | 1850 | _zeroFlag = true; |
1851 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
1850 | d.BodyEnable(Body); | 1852 | d.BodyEnable(Body); |
1851 | |||
1852 | } | 1853 | } |
1853 | } | 1854 | } |
1854 | resetCollisionAccounting(); | 1855 | resetCollisionAccounting(); |
@@ -2900,6 +2901,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2900 | if (Body != IntPtr.Zero && !m_disabled) | 2901 | if (Body != IntPtr.Zero && !m_disabled) |
2901 | { | 2902 | { |
2902 | _zeroFlag = true; | 2903 | _zeroFlag = true; |
2904 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
2903 | d.BodyEnable(Body); | 2905 | d.BodyEnable(Body); |
2904 | } | 2906 | } |
2905 | } | 2907 | } |
@@ -2933,6 +2935,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2933 | if (!d.BodyIsEnabled(Body)) | 2935 | if (!d.BodyIsEnabled(Body)) |
2934 | { | 2936 | { |
2935 | _zeroFlag = true; | 2937 | _zeroFlag = true; |
2938 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
2936 | d.BodyEnable(Body); | 2939 | d.BodyEnable(Body); |
2937 | } | 2940 | } |
2938 | } | 2941 | } |
@@ -2947,6 +2950,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2947 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 2950 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) |
2948 | { | 2951 | { |
2949 | _zeroFlag = true; | 2952 | _zeroFlag = true; |
2953 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
2950 | d.BodyEnable(Body); | 2954 | d.BodyEnable(Body); |
2951 | } | 2955 | } |
2952 | } | 2956 | } |
@@ -3012,6 +3016,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3012 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 3016 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) |
3013 | { | 3017 | { |
3014 | _zeroFlag = true; | 3018 | _zeroFlag = true; |
3019 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3015 | d.BodyEnable(Body); | 3020 | d.BodyEnable(Body); |
3016 | } | 3021 | } |
3017 | } | 3022 | } |
@@ -3070,6 +3075,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3070 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 3075 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) |
3071 | { | 3076 | { |
3072 | _zeroFlag = true; | 3077 | _zeroFlag = true; |
3078 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3073 | d.BodyEnable(Body); | 3079 | d.BodyEnable(Body); |
3074 | } | 3080 | } |
3075 | } | 3081 | } |
@@ -3312,8 +3318,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3312 | if (m_disabled) | 3318 | if (m_disabled) |
3313 | enableBodySoft(); | 3319 | enableBodySoft(); |
3314 | else if (!d.BodyIsEnabled(Body)) | 3320 | else if (!d.BodyIsEnabled(Body)) |
3321 | { | ||
3322 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3315 | d.BodyEnable(Body); | 3323 | d.BodyEnable(Body); |
3316 | 3324 | } | |
3317 | } | 3325 | } |
3318 | m_torque = newtorque; | 3326 | m_torque = newtorque; |
3319 | } | 3327 | } |
@@ -3323,7 +3331,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3323 | { | 3331 | { |
3324 | m_force = force; | 3332 | m_force = force; |
3325 | if (!m_isSelected && !m_outbounds && Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 3333 | if (!m_isSelected && !m_outbounds && Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) |
3334 | { | ||
3335 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3326 | d.BodyEnable(Body); | 3336 | d.BodyEnable(Body); |
3337 | } | ||
3327 | } | 3338 | } |
3328 | 3339 | ||
3329 | private void changeAddForce(Vector3 theforce) | 3340 | private void changeAddForce(Vector3 theforce) |
@@ -3339,7 +3350,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3339 | if (m_disabled) | 3350 | if (m_disabled) |
3340 | enableBodySoft(); | 3351 | enableBodySoft(); |
3341 | else if (!d.BodyIsEnabled(Body)) | 3352 | else if (!d.BodyIsEnabled(Body)) |
3353 | { | ||
3354 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3342 | d.BodyEnable(Body); | 3355 | d.BodyEnable(Body); |
3356 | } | ||
3343 | } | 3357 | } |
3344 | } | 3358 | } |
3345 | m_collisionscore = 0; | 3359 | m_collisionscore = 0; |
@@ -3359,7 +3373,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3359 | if (m_disabled) | 3373 | if (m_disabled) |
3360 | enableBodySoft(); | 3374 | enableBodySoft(); |
3361 | else if (!d.BodyIsEnabled(Body)) | 3375 | else if (!d.BodyIsEnabled(Body)) |
3376 | { | ||
3377 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3362 | d.BodyEnable(Body); | 3378 | d.BodyEnable(Body); |
3379 | } | ||
3363 | } | 3380 | } |
3364 | } | 3381 | } |
3365 | m_collisionscore = 0; | 3382 | m_collisionscore = 0; |
@@ -3382,7 +3399,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3382 | if (m_disabled) | 3399 | if (m_disabled) |
3383 | enableBodySoft(); | 3400 | enableBodySoft(); |
3384 | else if (!d.BodyIsEnabled(Body)) | 3401 | else if (!d.BodyIsEnabled(Body)) |
3402 | { | ||
3403 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3385 | d.BodyEnable(Body); | 3404 | d.BodyEnable(Body); |
3405 | } | ||
3386 | d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z); | 3406 | d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z); |
3387 | } | 3407 | } |
3388 | //resetCollisionAccounting(); | 3408 | //resetCollisionAccounting(); |
@@ -3406,7 +3426,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3406 | if (m_disabled) | 3426 | if (m_disabled) |
3407 | enableBodySoft(); | 3427 | enableBodySoft(); |
3408 | else if (!d.BodyIsEnabled(Body)) | 3428 | else if (!d.BodyIsEnabled(Body)) |
3429 | { | ||
3430 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3409 | d.BodyEnable(Body); | 3431 | d.BodyEnable(Body); |
3432 | } | ||
3410 | d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z); | 3433 | d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z); |
3411 | } | 3434 | } |
3412 | //resetCollisionAccounting(); | 3435 | //resetCollisionAccounting(); |
@@ -3571,12 +3594,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3571 | d.BodySetAngularVel(Body,0f,0f,0f); | 3594 | d.BodySetAngularVel(Body,0f,0f,0f); |
3572 | d.BodySetLinearVel(Body,0f,0f,0f); | 3595 | d.BodySetLinearVel(Body,0f,0f,0f); |
3573 | _zeroFlag = true; | 3596 | _zeroFlag = true; |
3597 | d.BodySetAutoDisableSteps(Body, 1); | ||
3574 | d.BodyEnable(Body); | 3598 | d.BodyEnable(Body); |
3575 | m_bodydisablecontrol = -4; | 3599 | m_bodydisablecontrol = -3; |
3576 | } | 3600 | } |
3577 | 3601 | ||
3578 | if(m_bodydisablecontrol < 0) | 3602 | if(m_bodydisablecontrol < 0) |
3579 | m_bodydisablecontrol ++; | 3603 | m_bodydisablecontrol++; |
3580 | 3604 | ||
3581 | d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator | 3605 | d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator |
3582 | 3606 | ||
@@ -3741,13 +3765,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3741 | 3765 | ||
3742 | public void UpdatePositionAndVelocity(int frame) | 3766 | public void UpdatePositionAndVelocity(int frame) |
3743 | { | 3767 | { |
3744 | if (_parent == null && !m_disabled && !m_building && !m_outbounds && Body != IntPtr.Zero) | 3768 | if (_parent == null && !m_isSelected && !m_disabled && !m_building && !m_outbounds && Body != IntPtr.Zero) |
3745 | { | 3769 | { |
3746 | bool bodyenabled = d.BodyIsEnabled(Body); | ||
3747 | |||
3748 | if(m_bodydisablecontrol < 0) | 3770 | if(m_bodydisablecontrol < 0) |
3749 | return; | 3771 | return; |
3750 | 3772 | ||
3773 | bool bodyenabled = d.BodyIsEnabled(Body); | ||
3751 | if (bodyenabled || !_zeroFlag) | 3774 | if (bodyenabled || !_zeroFlag) |
3752 | { | 3775 | { |
3753 | bool lastZeroFlag = _zeroFlag; | 3776 | bool lastZeroFlag = _zeroFlag; |
@@ -3891,7 +3914,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3891 | // disable interpolators | 3914 | // disable interpolators |
3892 | _velocity = Vector3.Zero; | 3915 | _velocity = Vector3.Zero; |
3893 | m_acceleration = Vector3.Zero; | 3916 | m_acceleration = Vector3.Zero; |
3894 | m_rotationalVelocity = Vector3.Zero; | 3917 | m_rotationalVelocity = Vector3.Zero; |
3895 | } | 3918 | } |
3896 | else | 3919 | else |
3897 | { | 3920 | { |