diff options
author | UbitUmarov | 2017-04-18 00:50:55 +0100 |
---|---|---|
committer | UbitUmarov | 2017-04-18 00:50:55 +0100 |
commit | 49884b94a78bcf45c25b72e1f9fae593de16864f (patch) | |
tree | 178a6b656b4735c7c9e5f1dbdf3cd11891ee4e95 /OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | |
parent | fix active objects count down, a path at least (diff) | |
download | opensim-SC-49884b94a78bcf45c25b72e1f9fae593de16864f.zip opensim-SC-49884b94a78bcf45c25b72e1f9fae593de16864f.tar.gz opensim-SC-49884b94a78bcf45c25b72e1f9fae593de16864f.tar.bz2 opensim-SC-49884b94a78bcf45c25b72e1f9fae593de16864f.tar.xz |
update ODE binaries for windows. Other platforms need to compile from opensim-libs repo, folder ODE-OpenSim-0.13.2, read file OPENSIM-README.txt. Remove code to reduce bounce on non physical placement, new unmanaged should handle that
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 199 |
1 files changed, 77 insertions, 122 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index bf0400b..7b77d2f 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | |||
@@ -111,7 +111,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
111 | 111 | ||
112 | private int m_body_autodisable_frames; | 112 | private int m_body_autodisable_frames; |
113 | public int m_bodydisablecontrol = 0; | 113 | public int m_bodydisablecontrol = 0; |
114 | public int m_bodyMoveCoolDown = 0; | ||
115 | private float m_gravmod = 1.0f; | 114 | private float m_gravmod = 1.0f; |
116 | 115 | ||
117 | // Default we're a Geometry | 116 | // Default we're a Geometry |
@@ -1030,18 +1029,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1030 | d.AllocateODEDataForThread(0); | 1029 | d.AllocateODEDataForThread(0); |
1031 | if(Body != IntPtr.Zero) | 1030 | if(Body != IntPtr.Zero) |
1032 | { | 1031 | { |
1033 | if(m_bodyMoveCoolDown >= 0) | 1032 | d.Vector3 dtmp = d.BodyGetAngularVel(Body); |
1034 | { | 1033 | m_rotationalVelocity.X = dtmp.X; |
1035 | d.Vector3 dtmp = d.BodyGetAngularVel(Body); | 1034 | m_rotationalVelocity.Y = dtmp.Y; |
1036 | m_rotationalVelocity.X = dtmp.X; | 1035 | m_rotationalVelocity.Z = dtmp.Z; |
1037 | m_rotationalVelocity.Y = dtmp.Y; | 1036 | |
1038 | m_rotationalVelocity.Z = dtmp.Z; | 1037 | dtmp = d.BodyGetLinearVel(Body); |
1038 | _velocity.X = dtmp.X; | ||
1039 | _velocity.Y = dtmp.Y; | ||
1040 | _velocity.Z = dtmp.Z; | ||
1039 | 1041 | ||
1040 | dtmp = d.BodyGetLinearVel(Body); | ||
1041 | _velocity.X = dtmp.X; | ||
1042 | _velocity.Y = dtmp.Y; | ||
1043 | _velocity.Z = dtmp.Z; | ||
1044 | } | ||
1045 | d.BodySetLinearVel(Body, 0, 0, 0); // stop it | 1042 | d.BodySetLinearVel(Body, 0, 0, 0); // stop it |
1046 | d.BodySetAngularVel(Body, 0, 0, 0); | 1043 | d.BodySetAngularVel(Body, 0, 0, 0); |
1047 | } | 1044 | } |
@@ -1345,7 +1342,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1345 | bounce = parent_scene.m_materialContactsData[(int)Material.Wood].bounce; | 1342 | bounce = parent_scene.m_materialContactsData[(int)Material.Wood].bounce; |
1346 | 1343 | ||
1347 | m_building = true; // control must set this to false when done | 1344 | m_building = true; // control must set this to false when done |
1348 | m_bodyMoveCoolDown = 0; | ||
1349 | 1345 | ||
1350 | AddChange(changes.Add, null); | 1346 | AddChange(changes.Add, null); |
1351 | 1347 | ||
@@ -2144,14 +2140,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2144 | } | 2140 | } |
2145 | else | 2141 | else |
2146 | { | 2142 | { |
2147 | /* | ||
2148 | d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); | 2143 | d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); |
2149 | d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); | 2144 | d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); |
2150 | */ | 2145 | |
2151 | _zeroFlag = false; | 2146 | _zeroFlag = false; |
2152 | m_bodydisablecontrol = 0; | 2147 | m_bodydisablecontrol = 0; |
2153 | } | 2148 | } |
2154 | m_bodyMoveCoolDown = -5; | ||
2155 | _parent_scene.addActiveGroups(this); | 2149 | _parent_scene.addActiveGroups(this); |
2156 | } | 2150 | } |
2157 | 2151 | ||
@@ -2244,7 +2238,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2244 | } | 2238 | } |
2245 | m_mass = primMass; | 2239 | m_mass = primMass; |
2246 | m_collisionscore = 0; | 2240 | m_collisionscore = 0; |
2247 | m_bodyMoveCoolDown = 0; | ||
2248 | } | 2241 | } |
2249 | 2242 | ||
2250 | private void FixInertia(Vector3 NewPos,Quaternion newrot) | 2243 | private void FixInertia(Vector3 NewPos,Quaternion newrot) |
@@ -2907,7 +2900,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2907 | { | 2900 | { |
2908 | _zeroFlag = true; | 2901 | _zeroFlag = true; |
2909 | d.BodyEnable(Body); | 2902 | d.BodyEnable(Body); |
2910 | m_bodyMoveCoolDown = -5; | ||
2911 | } | 2903 | } |
2912 | } | 2904 | } |
2913 | // else if (_parent != null) | 2905 | // else if (_parent != null) |
@@ -2950,8 +2942,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2950 | { | 2942 | { |
2951 | d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); | 2943 | d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); |
2952 | _position = newPos; | 2944 | _position = newPos; |
2953 | if (Body != IntPtr.Zero && !m_disabled) | ||
2954 | m_bodyMoveCoolDown = -5; | ||
2955 | } | 2945 | } |
2956 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 2946 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) |
2957 | { | 2947 | { |
@@ -3016,7 +3006,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3016 | { | 3006 | { |
3017 | if(m_angularlocks != 0) | 3007 | if(m_angularlocks != 0) |
3018 | createAMotor(m_angularlocks); | 3008 | createAMotor(m_angularlocks); |
3019 | m_bodyMoveCoolDown = -5; | ||
3020 | } | 3009 | } |
3021 | } | 3010 | } |
3022 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 3011 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) |
@@ -3391,8 +3380,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3391 | enableBodySoft(); | 3380 | enableBodySoft(); |
3392 | else if (!d.BodyIsEnabled(Body)) | 3381 | else if (!d.BodyIsEnabled(Body)) |
3393 | d.BodyEnable(Body); | 3382 | d.BodyEnable(Body); |
3394 | if(m_bodyMoveCoolDown >= 0) | ||
3395 | d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z); | ||
3396 | } | 3383 | } |
3397 | //resetCollisionAccounting(); | 3384 | //resetCollisionAccounting(); |
3398 | } | 3385 | } |
@@ -3416,9 +3403,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3416 | enableBodySoft(); | 3403 | enableBodySoft(); |
3417 | else if (!d.BodyIsEnabled(Body)) | 3404 | else if (!d.BodyIsEnabled(Body)) |
3418 | d.BodyEnable(Body); | 3405 | d.BodyEnable(Body); |
3419 | |||
3420 | if(m_bodyMoveCoolDown >= 0); | ||
3421 | d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z); | ||
3422 | } | 3406 | } |
3423 | //resetCollisionAccounting(); | 3407 | //resetCollisionAccounting(); |
3424 | } | 3408 | } |
@@ -3569,26 +3553,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3569 | if (!childPrim && m_isphysical && Body != IntPtr.Zero && | 3553 | if (!childPrim && m_isphysical && Body != IntPtr.Zero && |
3570 | !m_disabled && !m_isSelected && !m_building && !m_outbounds) | 3554 | !m_disabled && !m_isSelected && !m_building && !m_outbounds) |
3571 | { | 3555 | { |
3572 | if(m_bodyMoveCoolDown < 0) | ||
3573 | { | ||
3574 | m_bodyMoveCoolDown++; | ||
3575 | // if(!IsColliding) | ||
3576 | // m_bodyCoolDown +=2; | ||
3577 | if(m_bodyMoveCoolDown >= 0) | ||
3578 | { | ||
3579 | d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); | ||
3580 | d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); | ||
3581 | } | ||
3582 | else | ||
3583 | { | ||
3584 | d.BodySetAngularVel(Body, 0, 0, 0); | ||
3585 | d.BodySetLinearVel(Body, 0, 0, 0); | ||
3586 | m_forceacc = Vector3.Zero; | ||
3587 | m_angularForceacc = Vector3.Zero; | ||
3588 | _zeroFlag = false; | ||
3589 | return; | ||
3590 | } | ||
3591 | } | ||
3592 | if (!d.BodyIsEnabled(Body)) | 3556 | if (!d.BodyIsEnabled(Body)) |
3593 | { | 3557 | { |
3594 | // let vehicles sleep | 3558 | // let vehicles sleep |
@@ -3844,18 +3808,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3844 | m_lastposition = _position; | 3808 | m_lastposition = _position; |
3845 | m_lastorientation = _orientation; | 3809 | m_lastorientation = _orientation; |
3846 | 3810 | ||
3847 | if(m_bodyMoveCoolDown >= 0) | 3811 | d.Vector3 dtmp = d.BodyGetAngularVel(Body); |
3848 | { | 3812 | m_rotationalVelocity.X = dtmp.X; |
3849 | d.Vector3 dtmp = d.BodyGetAngularVel(Body); | 3813 | m_rotationalVelocity.Y = dtmp.Y; |
3850 | m_rotationalVelocity.X = dtmp.X; | 3814 | m_rotationalVelocity.Z = dtmp.Z; |
3851 | m_rotationalVelocity.Y = dtmp.Y; | 3815 | |
3852 | m_rotationalVelocity.Z = dtmp.Z; | 3816 | dtmp = d.BodyGetLinearVel(Body); |
3853 | 3817 | _velocity.X = dtmp.X; | |
3854 | dtmp = d.BodyGetLinearVel(Body); | 3818 | _velocity.Y = dtmp.Y; |
3855 | _velocity.X = dtmp.X; | 3819 | _velocity.Z = dtmp.Z; |
3856 | _velocity.Y = dtmp.Y; | ||
3857 | _velocity.Z = dtmp.Z; | ||
3858 | } | ||
3859 | 3820 | ||
3860 | d.BodySetLinearVel(Body, 0, 0, 0); // stop it | 3821 | d.BodySetLinearVel(Body, 0, 0, 0); // stop it |
3861 | d.BodySetAngularVel(Body, 0, 0, 0); | 3822 | d.BodySetAngularVel(Body, 0, 0, 0); |
@@ -3880,33 +3841,30 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3880 | } | 3841 | } |
3881 | else | 3842 | else |
3882 | { | 3843 | { |
3883 | if(m_bodyMoveCoolDown >= 0) | 3844 | float poserror; |
3845 | float angerror; | ||
3846 | if(_zeroFlag) | ||
3884 | { | 3847 | { |
3885 | float poserror; | 3848 | poserror = 0.01f; |
3886 | float angerror; | 3849 | angerror = 0.001f; |
3887 | if(_zeroFlag) | ||
3888 | { | ||
3889 | poserror = 0.01f; | ||
3890 | angerror = 0.001f; | ||
3891 | } | ||
3892 | else | ||
3893 | { | ||
3894 | poserror = 0.005f; | ||
3895 | angerror = 0.0005f; | ||
3896 | } | ||
3897 | |||
3898 | if ( | ||
3899 | (Math.Abs(_position.X - lpos.X) < poserror) | ||
3900 | && (Math.Abs(_position.Y - lpos.Y) < poserror) | ||
3901 | && (Math.Abs(_position.Z - lpos.Z) < poserror) | ||
3902 | && (Math.Abs(_orientation.X - ori.X) < angerror) | ||
3903 | && (Math.Abs(_orientation.Y - ori.Y) < angerror) | ||
3904 | && (Math.Abs(_orientation.Z - ori.Z) < angerror) // ignore W | ||
3905 | ) | ||
3906 | _zeroFlag = true; | ||
3907 | else | ||
3908 | _zeroFlag = false; | ||
3909 | } | 3850 | } |
3851 | else | ||
3852 | { | ||
3853 | poserror = 0.005f; | ||
3854 | angerror = 0.0005f; | ||
3855 | } | ||
3856 | |||
3857 | if ( | ||
3858 | (Math.Abs(_position.X - lpos.X) < poserror) | ||
3859 | && (Math.Abs(_position.Y - lpos.Y) < poserror) | ||
3860 | && (Math.Abs(_position.Z - lpos.Z) < poserror) | ||
3861 | && (Math.Abs(_orientation.X - ori.X) < angerror) | ||
3862 | && (Math.Abs(_orientation.Y - ori.Y) < angerror) | ||
3863 | && (Math.Abs(_orientation.Z - ori.Z) < angerror) // ignore W | ||
3864 | ) | ||
3865 | _zeroFlag = true; | ||
3866 | else | ||
3867 | _zeroFlag = false; | ||
3910 | } | 3868 | } |
3911 | 3869 | ||
3912 | // update position | 3870 | // update position |
@@ -3932,49 +3890,46 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3932 | } | 3890 | } |
3933 | else | 3891 | else |
3934 | { | 3892 | { |
3935 | if(m_bodyMoveCoolDown >= 0) | 3893 | d.Vector3 vel = d.BodyGetLinearVel(Body); |
3936 | { | ||
3937 | d.Vector3 vel = d.BodyGetLinearVel(Body); | ||
3938 | 3894 | ||
3939 | m_acceleration = _velocity; | 3895 | m_acceleration = _velocity; |
3940 | 3896 | ||
3941 | if ((Math.Abs(vel.X) < 0.005f) && | 3897 | if ((Math.Abs(vel.X) < 0.005f) && |
3942 | (Math.Abs(vel.Y) < 0.005f) && | 3898 | (Math.Abs(vel.Y) < 0.005f) && |
3943 | (Math.Abs(vel.Z) < 0.005f)) | 3899 | (Math.Abs(vel.Z) < 0.005f)) |
3944 | { | 3900 | { |
3945 | _velocity = Vector3.Zero; | 3901 | _velocity = Vector3.Zero; |
3946 | float t = -m_invTimeStep; | 3902 | float t = -m_invTimeStep; |
3947 | m_acceleration = m_acceleration * t; | 3903 | m_acceleration = m_acceleration * t; |
3948 | } | 3904 | } |
3949 | else | 3905 | else |
3950 | { | 3906 | { |
3951 | _velocity.X = vel.X; | 3907 | _velocity.X = vel.X; |
3952 | _velocity.Y = vel.Y; | 3908 | _velocity.Y = vel.Y; |
3953 | _velocity.Z = vel.Z; | 3909 | _velocity.Z = vel.Z; |
3954 | m_acceleration = (_velocity - m_acceleration) * m_invTimeStep; | 3910 | m_acceleration = (_velocity - m_acceleration) * m_invTimeStep; |
3955 | } | 3911 | } |
3956 | 3912 | ||
3957 | if ((Math.Abs(m_acceleration.X) < 0.01f) && | 3913 | if ((Math.Abs(m_acceleration.X) < 0.01f) && |
3958 | (Math.Abs(m_acceleration.Y) < 0.01f) && | 3914 | (Math.Abs(m_acceleration.Y) < 0.01f) && |
3959 | (Math.Abs(m_acceleration.Z) < 0.01f)) | 3915 | (Math.Abs(m_acceleration.Z) < 0.01f)) |
3960 | { | 3916 | { |
3961 | m_acceleration = Vector3.Zero; | 3917 | m_acceleration = Vector3.Zero; |
3962 | } | 3918 | } |
3963 | 3919 | ||
3964 | vel = d.BodyGetAngularVel(Body); | 3920 | vel = d.BodyGetAngularVel(Body); |
3965 | if ((Math.Abs(vel.X) < 0.0001) && | 3921 | if ((Math.Abs(vel.X) < 0.0001) && |
3966 | (Math.Abs(vel.Y) < 0.0001) && | 3922 | (Math.Abs(vel.Y) < 0.0001) && |
3967 | (Math.Abs(vel.Z) < 0.0001) | 3923 | (Math.Abs(vel.Z) < 0.0001) |
3968 | ) | 3924 | ) |
3969 | { | 3925 | { |
3970 | m_rotationalVelocity = Vector3.Zero; | 3926 | m_rotationalVelocity = Vector3.Zero; |
3971 | } | 3927 | } |
3972 | else | 3928 | else |
3973 | { | 3929 | { |
3974 | m_rotationalVelocity.X = vel.X; | 3930 | m_rotationalVelocity.X = vel.X; |
3975 | m_rotationalVelocity.Y = vel.Y; | 3931 | m_rotationalVelocity.Y = vel.Y; |
3976 | m_rotationalVelocity.Z = vel.Z; | 3932 | m_rotationalVelocity.Z = vel.Z; |
3977 | } | ||
3978 | } | 3933 | } |
3979 | } | 3934 | } |
3980 | 3935 | ||