diff options
author | Melanie | 2012-04-20 00:17:14 +0100 |
---|---|---|
committer | Melanie | 2012-04-20 00:17:14 +0100 |
commit | 65b3e13010cae460573db0f027efa94a6a958192 (patch) | |
tree | 71158af5b6f985b93b4e6bdb4814987cda386e81 /OpenSim/Region/Physics/UbitOdePlugin | |
parent | Fx up estate settings (diff) | |
parent | changed - VolumeDetect and phantom setting interaction. Script VD(true) forc... (diff) | |
download | opensim-SC-65b3e13010cae460573db0f027efa94a6a958192.zip opensim-SC-65b3e13010cae460573db0f027efa94a6a958192.tar.gz opensim-SC-65b3e13010cae460573db0f027efa94a6a958192.tar.bz2 opensim-SC-65b3e13010cae460573db0f027efa94a6a958192.tar.xz |
Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into careminster
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | 172 | ||||
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 124 | ||||
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 14 |
3 files changed, 104 insertions, 206 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index 9c1b87b..ec4be58 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | |||
@@ -683,7 +683,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
683 | PID_D *= m_mass / _parent_scene.ODE_STEPSIZE; | 683 | PID_D *= m_mass / _parent_scene.ODE_STEPSIZE; |
684 | PID_P /= 50 * 80; | 684 | PID_P /= 50 * 80; |
685 | PID_P *= m_mass / _parent_scene.ODE_STEPSIZE; | 685 | PID_P *= m_mass / _parent_scene.ODE_STEPSIZE; |
686 | 686 | ||
687 | Body = d.BodyCreate(_parent_scene.world); | 687 | Body = d.BodyCreate(_parent_scene.world); |
688 | 688 | ||
689 | d.BodySetAutoDisableFlag(Body, false); | 689 | d.BodySetAutoDisableFlag(Body, false); |
@@ -771,16 +771,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
771 | /// <param name="timeStep"></param> | 771 | /// <param name="timeStep"></param> |
772 | public void Move(float timeStep, List<OdeCharacter> defects) | 772 | public void Move(float timeStep, List<OdeCharacter> defects) |
773 | { | 773 | { |
774 | // no lock; for now it's only called from within Simulate() | ||
775 | |||
776 | // If the PID Controller isn't active then we set our force | ||
777 | // calculating base velocity to the current position | ||
778 | |||
779 | if (Body == IntPtr.Zero) | 774 | if (Body == IntPtr.Zero) |
780 | return; | 775 | return; |
781 | 776 | ||
782 | d.Vector3 dtmp; | 777 | d.Vector3 dtmp = d.BodyGetPosition(Body); |
783 | d.BodyCopyPosition(Body, out dtmp); | ||
784 | Vector3 localpos = new Vector3(dtmp.X, dtmp.Y, dtmp.Z); | 778 | Vector3 localpos = new Vector3(dtmp.X, dtmp.Y, dtmp.Z); |
785 | 779 | ||
786 | // the Amotor still lets avatar rotation to drift during colisions | 780 | // the Amotor still lets avatar rotation to drift during colisions |
@@ -797,22 +791,43 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
797 | { | 791 | { |
798 | _zeroPosition = localpos; | 792 | _zeroPosition = localpos; |
799 | } | 793 | } |
800 | //PidStatus = true; | ||
801 | |||
802 | 794 | ||
803 | if (!localpos.IsFinite()) | 795 | if (!localpos.IsFinite()) |
804 | { | 796 | { |
805 | |||
806 | m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); | 797 | m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); |
807 | defects.Add(this); | 798 | defects.Add(this); |
808 | // _parent_scene.RemoveCharacter(this); | 799 | // _parent_scene.RemoveCharacter(this); |
809 | 800 | ||
810 | // destroy avatar capsule and related ODE data | 801 | // destroy avatar capsule and related ODE data |
811 | AvatarGeomAndBodyDestroy(); | 802 | AvatarGeomAndBodyDestroy(); |
812 | |||
813 | return; | 803 | return; |
814 | } | 804 | } |
815 | 805 | ||
806 | // check outbounds forcing to be in world | ||
807 | bool fixbody = false; | ||
808 | if (localpos.X < 0.0f) | ||
809 | { | ||
810 | fixbody = true; | ||
811 | localpos.X = 0.1f; | ||
812 | } | ||
813 | else if (localpos.X > _parent_scene.WorldExtents.X - 0.1f) | ||
814 | { | ||
815 | fixbody = true; | ||
816 | localpos.X = _parent_scene.WorldExtents.X - 0.1f; | ||
817 | } | ||
818 | if (localpos.Y < 0.0f) | ||
819 | { | ||
820 | fixbody = true; | ||
821 | localpos.Y = 0.1f; | ||
822 | } | ||
823 | else if (localpos.Y > _parent_scene.WorldExtents.Y - 0.1) | ||
824 | { | ||
825 | fixbody = true; | ||
826 | localpos.Y = _parent_scene.WorldExtents.Y - 0.1f; | ||
827 | } | ||
828 | if (fixbody) | ||
829 | d.BodySetPosition(Body, localpos.X, localpos.Y, localpos.Z); | ||
830 | |||
816 | Vector3 vec = Vector3.Zero; | 831 | Vector3 vec = Vector3.Zero; |
817 | dtmp = d.BodyGetLinearVel(Body); | 832 | dtmp = d.BodyGetLinearVel(Body); |
818 | Vector3 vel = new Vector3(dtmp.X, dtmp.Y, dtmp.Z); | 833 | Vector3 vel = new Vector3(dtmp.X, dtmp.Y, dtmp.Z); |
@@ -820,16 +835,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
820 | float movementdivisor = 1f; | 835 | float movementdivisor = 1f; |
821 | //Ubit change divisions into multiplications below | 836 | //Ubit change divisions into multiplications below |
822 | if (!m_alwaysRun) | 837 | if (!m_alwaysRun) |
823 | { | ||
824 | movementdivisor = 1 / walkDivisor; | 838 | movementdivisor = 1 / walkDivisor; |
825 | } | ||
826 | else | 839 | else |
827 | { | ||
828 | movementdivisor = 1 / runDivisor; | 840 | movementdivisor = 1 / runDivisor; |
829 | } | ||
830 | 841 | ||
842 | //****************************************** | ||
831 | // colide with land | 843 | // colide with land |
832 | |||
833 | d.AABB aabb; | 844 | d.AABB aabb; |
834 | d.GeomGetAABB(Shell, out aabb); | 845 | d.GeomGetAABB(Shell, out aabb); |
835 | float chrminZ = aabb.MinZ; | 846 | float chrminZ = aabb.MinZ; |
@@ -851,32 +862,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
851 | float depth = terrainheight - chrminZ; | 862 | float depth = terrainheight - chrminZ; |
852 | if (!flying) | 863 | if (!flying) |
853 | { | 864 | { |
854 | vec.Z = -vel.Z * PID_D * 1.5f + depth * PID_P * 50; | 865 | vec.Z = -vel.Z * PID_D * 1.5f + depth * PID_P * 60; |
855 | } | 866 | } |
856 | else | 867 | else |
857 | vec.Z = depth * PID_P * 50; | 868 | vec.Z = depth * PID_P * 60; |
858 | |||
859 | /* | ||
860 | Vector3 vtmp; | ||
861 | vtmp.X = _target_velocity.X * timeStep; | ||
862 | vtmp.Y = _target_velocity.Y * timeStep; | ||
863 | // fake and avoid squares | ||
864 | float k = (Math.Abs(vtmp.X) + Math.Abs(vtmp.Y)); | ||
865 | if (k > 0) | ||
866 | { | ||
867 | posch.X += vtmp.X; | ||
868 | posch.Y += vtmp.Y; | ||
869 | terrainheight -= _parent_scene.GetTerrainHeightAtXY(posch.X, posch.Y); | ||
870 | k = 1 + Math.Abs(terrainheight) / k; | ||
871 | movementdivisor /= k; | ||
872 | |||
873 | if (k < 1) | ||
874 | k = 1; | ||
875 | } | ||
876 | */ | ||
877 | 869 | ||
878 | 870 | if (depth < 0.2f) | |
879 | if (depth < 0.1f) | ||
880 | { | 871 | { |
881 | m_iscolliding = true; | 872 | m_iscolliding = true; |
882 | m_colliderfilter = 2; | 873 | m_colliderfilter = 2; |
@@ -901,6 +892,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
901 | else | 892 | else |
902 | m_iscollidingGround = false; | 893 | m_iscollidingGround = false; |
903 | 894 | ||
895 | //****************************************** | ||
904 | 896 | ||
905 | // if velocity is zero, use position control; otherwise, velocity control | 897 | // if velocity is zero, use position control; otherwise, velocity control |
906 | if (_target_velocity.X == 0.0f && _target_velocity.Y == 0.0f && _target_velocity.Z == 0.0f | 898 | if (_target_velocity.X == 0.0f && _target_velocity.Y == 0.0f && _target_velocity.Z == 0.0f |
@@ -1012,97 +1004,31 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1012 | // _parent_scene.RemoveCharacter(this); | 1004 | // _parent_scene.RemoveCharacter(this); |
1013 | // destroy avatar capsule and related ODE data | 1005 | // destroy avatar capsule and related ODE data |
1014 | AvatarGeomAndBodyDestroy(); | 1006 | AvatarGeomAndBodyDestroy(); |
1007 | return; | ||
1015 | } | 1008 | } |
1009 | |||
1010 | // update our local ideia of position velocity and aceleration | ||
1011 | _position = localpos; | ||
1012 | _acceleration = _velocity; // previus velocity | ||
1013 | _velocity = vel; | ||
1014 | _acceleration = (vel - _acceleration) / timeStep; | ||
1015 | |||
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | /// <summary> | 1018 | /// <summary> |
1019 | /// Updates the reported position and velocity. This essentially sends the data up to ScenePresence. | 1019 | /// Updates the reported position and velocity. |
1020 | /// Used to copy variables from unmanaged space at heartbeat rate and also trigger scene updates acording | ||
1021 | /// also outbounds checking | ||
1022 | /// copy and outbounds now done in move(..) at ode rate | ||
1023 | /// | ||
1020 | /// </summary> | 1024 | /// </summary> |
1021 | public void UpdatePositionAndVelocity() | 1025 | public void UpdatePositionAndVelocity() |
1022 | { | 1026 | { |
1023 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 1027 | return; |
1024 | if (Body == IntPtr.Zero) | ||
1025 | return; | ||
1026 | |||
1027 | d.Vector3 vec; | ||
1028 | try | ||
1029 | { | ||
1030 | d.BodyCopyPosition(Body, out vec); | ||
1031 | } | ||
1032 | catch (NullReferenceException) | ||
1033 | { | ||
1034 | bad = true; | ||
1035 | _parent_scene.BadCharacter(this); | ||
1036 | vec = new d.Vector3(_position.X, _position.Y, _position.Z); | ||
1037 | base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem! | ||
1038 | m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar {0}, physical actor {1}", m_name, m_uuid); | ||
1039 | } | ||
1040 | |||
1041 | _position.X = vec.X; | ||
1042 | _position.Y = vec.Y; | ||
1043 | _position.Z = vec.Z; | ||
1044 | 1028 | ||
1045 | bool fixbody = false; | 1029 | // if (Body == IntPtr.Zero) |
1046 | 1030 | // return; | |
1047 | if (_position.X < 0.0f) | ||
1048 | { | ||
1049 | fixbody = true; | ||
1050 | _position.X = 0.1f; | ||
1051 | } | ||
1052 | else if (_position.X > (int)_parent_scene.WorldExtents.X - 0.1f) | ||
1053 | { | ||
1054 | fixbody = true; | ||
1055 | _position.X = (int)_parent_scene.WorldExtents.X - 0.1f; | ||
1056 | } | ||
1057 | 1031 | ||
1058 | if (_position.Y < 0.0f) | ||
1059 | { | ||
1060 | fixbody = true; | ||
1061 | _position.Y = 0.1f; | ||
1062 | } | ||
1063 | else if (_position.Y > (int)_parent_scene.WorldExtents.Y - 0.1) | ||
1064 | { | ||
1065 | fixbody = true; | ||
1066 | _position.Y = (int)_parent_scene.WorldExtents.Y - 0.1f; | ||
1067 | } | ||
1068 | |||
1069 | if (fixbody) | ||
1070 | d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); | ||
1071 | |||
1072 | // Did we move last? = zeroflag | ||
1073 | // This helps keep us from sliding all over | ||
1074 | /* | ||
1075 | if (_zeroFlag) | ||
1076 | { | ||
1077 | _velocity.X = 0.0f; | ||
1078 | _velocity.Y = 0.0f; | ||
1079 | _velocity.Z = 0.0f; | ||
1080 | |||
1081 | // Did we send out the 'stopped' message? | ||
1082 | if (!m_lastUpdateSent) | ||
1083 | { | ||
1084 | m_lastUpdateSent = true; | ||
1085 | base.RequestPhysicsterseUpdate(); | ||
1086 | } | ||
1087 | } | ||
1088 | else | ||
1089 | { | ||
1090 | m_lastUpdateSent = false; | ||
1091 | */ | ||
1092 | try | ||
1093 | { | ||
1094 | vec = d.BodyGetLinearVel(Body); | ||
1095 | } | ||
1096 | catch (NullReferenceException) | ||
1097 | { | ||
1098 | vec.X = _velocity.X; | ||
1099 | vec.Y = _velocity.Y; | ||
1100 | vec.Z = _velocity.Z; | ||
1101 | } | ||
1102 | _velocity.X = (vec.X); | ||
1103 | _velocity.Y = (vec.Y); | ||
1104 | _velocity.Z = (vec.Z); | ||
1105 | // } | ||
1106 | } | 1032 | } |
1107 | 1033 | ||
1108 | /// <summary> | 1034 | /// <summary> |
@@ -1245,7 +1171,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1245 | CAPSULE_LENGTH = caplen; | 1171 | CAPSULE_LENGTH = caplen; |
1246 | 1172 | ||
1247 | AvatarGeomAndBodyCreation(_position.X, _position.Y, | 1173 | AvatarGeomAndBodyCreation(_position.X, _position.Y, |
1248 | _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2)); | 1174 | _position.Z + (CAPSULE_LENGTH - prevCapsule) * 0.5f); |
1249 | 1175 | ||
1250 | Velocity = Vector3.Zero; | 1176 | Velocity = Vector3.Zero; |
1251 | 1177 | ||
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 32c4722..5467b9f 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -3228,17 +3228,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3228 | { | 3228 | { |
3229 | if (!childPrim && m_isphysical && Body != IntPtr.Zero && | 3229 | if (!childPrim && m_isphysical && Body != IntPtr.Zero && |
3230 | !m_disabled && !m_isSelected && !m_building && !m_outbounds) | 3230 | !m_disabled && !m_isSelected && !m_building && !m_outbounds) |
3231 | // !m_disabled && !m_isSelected && !m_building && !m_outbounds) | ||
3232 | { | 3231 | { |
3233 | // if (!d.BodyIsEnabled(Body)) d.BodyEnable(Body); // KF add 161009 | ||
3234 | |||
3235 | if (d.BodyIsEnabled(Body)) | 3232 | if (d.BodyIsEnabled(Body)) |
3236 | { | 3233 | { |
3237 | float timestep = _parent_scene.ODE_STEPSIZE; | 3234 | float timestep = _parent_scene.ODE_STEPSIZE; |
3238 | 3235 | ||
3239 | // check outside region | 3236 | // check outside region |
3240 | d.Vector3 lpos; | 3237 | d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator |
3241 | d.GeomCopyPosition(prim_geom, out lpos); // root position that is seem by rest of simulator | ||
3242 | 3238 | ||
3243 | if (lpos.Z < -100 || lpos.Z > 100000f) | 3239 | if (lpos.Z < -100 || lpos.Z > 100000f) |
3244 | { | 3240 | { |
@@ -3321,12 +3317,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3321 | { | 3317 | { |
3322 | // 'VEHICLES' are dealt with in ODEDynamics.cs | 3318 | // 'VEHICLES' are dealt with in ODEDynamics.cs |
3323 | m_vehicle.Step(); | 3319 | m_vehicle.Step(); |
3324 | return; | ||
3325 | } | 3320 | } |
3326 | |||
3327 | else | 3321 | else |
3328 | { | 3322 | { |
3329 | |||
3330 | float fx = 0; | 3323 | float fx = 0; |
3331 | float fy = 0; | 3324 | float fy = 0; |
3332 | float fz = 0; | 3325 | float fz = 0; |
@@ -3512,10 +3505,39 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3512 | { | 3505 | { |
3513 | d.BodyAddTorque(Body, trq.X, trq.Y, trq.Z); | 3506 | d.BodyAddTorque(Body, trq.X, trq.Y, trq.Z); |
3514 | } | 3507 | } |
3515 | |||
3516 | } | 3508 | } |
3509 | |||
3510 | // update our ideia of velocities and acelerations | ||
3511 | d.Quaternion ori; | ||
3512 | d.Vector3 dtmpu; | ||
3513 | |||
3514 | _position.X = lpos.X; | ||
3515 | _position.Y = lpos.Y; | ||
3516 | _position.Z = lpos.Z; | ||
3517 | |||
3518 | d.GeomCopyQuaternion(prim_geom, out ori); | ||
3519 | _orientation.X = ori.X; | ||
3520 | _orientation.Y = ori.Y; | ||
3521 | _orientation.Z = ori.Z; | ||
3522 | _orientation.W = ori.W; | ||
3523 | |||
3524 | _acceleration = _velocity; | ||
3525 | |||
3526 | dtmpu = d.BodyGetLinearVel(Body); | ||
3527 | _velocity.X = dtmpu.X; | ||
3528 | _velocity.Y = dtmpu.Y; | ||
3529 | _velocity.Z = dtmpu.Z; | ||
3530 | |||
3531 | float invts = 1 / timestep; | ||
3532 | _acceleration = (_velocity - _acceleration) * invts; | ||
3533 | |||
3534 | dtmpu = d.BodyGetAngularVel(Body); | ||
3535 | m_rotationalVelocity.X = dtmpu.X; | ||
3536 | m_rotationalVelocity.Y = dtmpu.Y; | ||
3537 | m_rotationalVelocity.Z = dtmpu.Z; | ||
3517 | } | 3538 | } |
3518 | else // body disabled | 3539 | |
3540 | else // body disabled/sleeping | ||
3519 | { | 3541 | { |
3520 | // let vehicles sleep | 3542 | // let vehicles sleep |
3521 | if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) | 3543 | if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) |
@@ -3546,36 +3568,23 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3546 | { | 3568 | { |
3547 | if (Body != IntPtr.Zero) | 3569 | if (Body != IntPtr.Zero) |
3548 | { | 3570 | { |
3549 | Vector3 pv = Vector3.Zero; | ||
3550 | bool lastZeroFlag = _zeroFlag; | 3571 | bool lastZeroFlag = _zeroFlag; |
3551 | 3572 | ||
3552 | d.Vector3 lpos; | 3573 | if ((Math.Abs(m_lastposition.X - _position.X) < 0.01) |
3553 | d.GeomCopyPosition(prim_geom, out lpos); // root position that is seem by rest of simulator | 3574 | && (Math.Abs(m_lastposition.Y - _position.Y) < 0.01) |
3554 | 3575 | && (Math.Abs(m_lastposition.Z - _position.Z) < 0.01) | |
3555 | 3576 | && (Math.Abs(m_lastorientation.X - _orientation.X) < 0.0001) | |
3556 | d.Quaternion ori; | 3577 | && (Math.Abs(m_lastorientation.Y - _orientation.Y) < 0.0001) |
3557 | d.GeomCopyQuaternion(prim_geom, out ori); | 3578 | && (Math.Abs(m_lastorientation.Z - _orientation.Z) < 0.0001) |
3558 | d.Vector3 vel = d.BodyGetLinearVel(Body); | ||
3559 | d.Vector3 rotvel = d.BodyGetAngularVel(Body); | ||
3560 | |||
3561 | if ((Math.Abs(m_lastposition.X - lpos.X) < 0.01) | ||
3562 | && (Math.Abs(m_lastposition.Y - lpos.Y) < 0.01) | ||
3563 | && (Math.Abs(m_lastposition.Z - lpos.Z) < 0.01) | ||
3564 | && (Math.Abs(m_lastorientation.X - ori.X) < 0.0001) | ||
3565 | && (Math.Abs(m_lastorientation.Y - ori.Y) < 0.0001) | ||
3566 | && (Math.Abs(m_lastorientation.Z - ori.Z) < 0.0001) | ||
3567 | ) | 3579 | ) |
3568 | { | 3580 | { |
3569 | _zeroFlag = true; | 3581 | _zeroFlag = true; |
3570 | //Console.WriteLine("ZFT 2"); | ||
3571 | m_throttleUpdates = false; | 3582 | m_throttleUpdates = false; |
3572 | } | 3583 | } |
3573 | else | 3584 | else |
3574 | { | 3585 | { |
3575 | //m_log.Debug(Math.Abs(m_lastposition.X - l_position.X).ToString()); | ||
3576 | _zeroFlag = false; | 3586 | _zeroFlag = false; |
3577 | m_lastUpdateSent = false; | 3587 | m_lastUpdateSent = false; |
3578 | //m_throttleUpdates = false; | ||
3579 | } | 3588 | } |
3580 | 3589 | ||
3581 | if (_zeroFlag) | 3590 | if (_zeroFlag) |
@@ -3583,22 +3592,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3583 | m_lastposition = _position; | 3592 | m_lastposition = _position; |
3584 | m_lastorientation = _orientation; | 3593 | m_lastorientation = _orientation; |
3585 | 3594 | ||
3586 | _velocity.X = 0.0f; | 3595 | _velocity = Vector3.Zero; |
3587 | _velocity.Y = 0.0f; | 3596 | _acceleration = Vector3.Zero; |
3588 | _velocity.Z = 0.0f; | 3597 | m_rotationalVelocity = Vector3.Zero; |
3589 | 3598 | ||
3590 | _acceleration.X = 0; | ||
3591 | _acceleration.Y = 0; | ||
3592 | _acceleration.Z = 0; | ||
3593 | |||
3594 | m_rotationalVelocity.X = 0; | ||
3595 | m_rotationalVelocity.Y = 0; | ||
3596 | m_rotationalVelocity.Z = 0; | ||
3597 | if (!m_lastUpdateSent) | 3599 | if (!m_lastUpdateSent) |
3598 | { | 3600 | { |
3599 | m_throttleUpdates = false; | 3601 | m_throttleUpdates = false; |
3600 | throttleCounter = 0; | 3602 | throttleCounter = 0; |
3601 | m_rotationalVelocity = pv; | ||
3602 | 3603 | ||
3603 | base.RequestPhysicsterseUpdate(); | 3604 | base.RequestPhysicsterseUpdate(); |
3604 | 3605 | ||
@@ -3612,39 +3613,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3612 | base.RequestPhysicsterseUpdate(); | 3613 | base.RequestPhysicsterseUpdate(); |
3613 | } | 3614 | } |
3614 | 3615 | ||
3615 | m_lastVelocity = _velocity; | ||
3616 | |||
3617 | _position.X = lpos.X; | ||
3618 | _position.Y = lpos.Y; | ||
3619 | _position.Z = lpos.Z; | ||
3620 | |||
3621 | _velocity.X = vel.X; | ||
3622 | _velocity.Y = vel.Y; | ||
3623 | _velocity.Z = vel.Z; | ||
3624 | |||
3625 | _orientation.X = ori.X; | ||
3626 | _orientation.Y = ori.Y; | ||
3627 | _orientation.Z = ori.Z; | ||
3628 | _orientation.W = ori.W; | ||
3629 | |||
3630 | _acceleration = ((_velocity - m_lastVelocity) / simulatedtime); | ||
3631 | |||
3632 | if (m_rotationalVelocity.ApproxEquals(pv, 0.0001f)) | ||
3633 | { | ||
3634 | m_rotationalVelocity = pv; | ||
3635 | } | ||
3636 | else | ||
3637 | { | ||
3638 | m_rotationalVelocity.X = rotvel.X; | ||
3639 | m_rotationalVelocity.Y = rotvel.Y; | ||
3640 | m_rotationalVelocity.Z = rotvel.Z; | ||
3641 | } | ||
3642 | |||
3643 | m_lastUpdateSent = false; | 3616 | m_lastUpdateSent = false; |
3644 | if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate) | 3617 | if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate) |
3645 | { | 3618 | { |
3646 | m_lastposition = _position; | 3619 | m_lastposition = _position; |
3647 | m_lastorientation = _orientation; | 3620 | m_lastorientation = _orientation; |
3621 | m_lastVelocity = _velocity; | ||
3648 | base.RequestPhysicsterseUpdate(); | 3622 | base.RequestPhysicsterseUpdate(); |
3649 | } | 3623 | } |
3650 | else | 3624 | else |
@@ -3656,17 +3630,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3656 | else if (!m_lastUpdateSent || !_zeroFlag) | 3630 | else if (!m_lastUpdateSent || !_zeroFlag) |
3657 | { | 3631 | { |
3658 | // Not a body.. so Make sure the client isn't interpolating | 3632 | // Not a body.. so Make sure the client isn't interpolating |
3659 | _velocity.X = 0; | 3633 | _velocity = Vector3.Zero; |
3660 | _velocity.Y = 0; | 3634 | _acceleration = Vector3.Zero; |
3661 | _velocity.Z = 0; | 3635 | m_rotationalVelocity = Vector3.Zero; |
3662 | 3636 | m_lastVelocity = Vector3.Zero; | |
3663 | _acceleration.X = 0; | ||
3664 | _acceleration.Y = 0; | ||
3665 | _acceleration.Z = 0; | ||
3666 | 3637 | ||
3667 | m_rotationalVelocity.X = 0; | ||
3668 | m_rotationalVelocity.Y = 0; | ||
3669 | m_rotationalVelocity.Z = 0; | ||
3670 | _zeroFlag = true; | 3638 | _zeroFlag = true; |
3671 | 3639 | ||
3672 | if (!m_lastUpdateSent) | 3640 | if (!m_lastUpdateSent) |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 7632e25..9ca2d3f 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -455,15 +455,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
455 | 455 | ||
456 | geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", geomDefaultDensity); | 456 | geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", geomDefaultDensity); |
457 | bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", bodyFramesAutoDisable); | 457 | bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", bodyFramesAutoDisable); |
458 | 458 | /* | |
459 | bodyPIDD = physicsconfig.GetFloat("body_pid_derivative", bodyPIDD); | 459 | bodyPIDD = physicsconfig.GetFloat("body_pid_derivative", bodyPIDD); |
460 | bodyPIDG = physicsconfig.GetFloat("body_pid_gain", bodyPIDG); | 460 | bodyPIDG = physicsconfig.GetFloat("body_pid_gain", bodyPIDG); |
461 | 461 | */ | |
462 | forceSimplePrimMeshing = physicsconfig.GetBoolean("force_simple_prim_meshing", forceSimplePrimMeshing); | 462 | forceSimplePrimMeshing = physicsconfig.GetBoolean("force_simple_prim_meshing", forceSimplePrimMeshing); |
463 | meshSculptedPrim = physicsconfig.GetBoolean("mesh_sculpted_prim", meshSculptedPrim); | 463 | meshSculptedPrim = physicsconfig.GetBoolean("mesh_sculpted_prim", meshSculptedPrim); |
464 | meshSculptLOD = physicsconfig.GetFloat("mesh_lod", meshSculptLOD); | 464 | meshSculptLOD = physicsconfig.GetFloat("mesh_lod", meshSculptLOD); |
465 | MeshSculptphysicalLOD = physicsconfig.GetFloat("mesh_physical_lod", MeshSculptphysicalLOD); | 465 | MeshSculptphysicalLOD = physicsconfig.GetFloat("mesh_physical_lod", MeshSculptphysicalLOD); |
466 | 466 | /* | |
467 | if (Environment.OSVersion.Platform == PlatformID.Unix) | 467 | if (Environment.OSVersion.Platform == PlatformID.Unix) |
468 | { | 468 | { |
469 | avPIDD = physicsconfig.GetFloat("av_pid_derivative_linux", avPIDD); | 469 | avPIDD = physicsconfig.GetFloat("av_pid_derivative_linux", avPIDD); |
@@ -471,10 +471,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
471 | } | 471 | } |
472 | else | 472 | else |
473 | { | 473 | { |
474 | |||
474 | avPIDD = physicsconfig.GetFloat("av_pid_derivative_win", avPIDD); | 475 | avPIDD = physicsconfig.GetFloat("av_pid_derivative_win", avPIDD); |
475 | avPIDP = physicsconfig.GetFloat("av_pid_proportional_win", avPIDP); | 476 | avPIDP = physicsconfig.GetFloat("av_pid_proportional_win", avPIDP); |
476 | } | 477 | } |
477 | 478 | */ | |
478 | physics_logging = physicsconfig.GetBoolean("physics_logging", false); | 479 | physics_logging = physicsconfig.GetBoolean("physics_logging", false); |
479 | physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); | 480 | physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); |
480 | physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false); | 481 | physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false); |
@@ -1860,6 +1861,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1860 | 1861 | ||
1861 | statstart = Util.EnvironmentTickCount(); | 1862 | statstart = Util.EnvironmentTickCount(); |
1862 | 1863 | ||
1864 | /* | ||
1865 | // now included in characters move() and done at ode rate | ||
1866 | // maybe be needed later if we need to do any extra work at hearbeat rate | ||
1863 | lock (_characters) | 1867 | lock (_characters) |
1864 | { | 1868 | { |
1865 | foreach (OdeCharacter actor in _characters) | 1869 | foreach (OdeCharacter actor in _characters) |
@@ -1873,7 +1877,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1873 | } | 1877 | } |
1874 | } | 1878 | } |
1875 | } | 1879 | } |
1876 | 1880 | */ | |
1877 | lock (_badCharacter) | 1881 | lock (_badCharacter) |
1878 | { | 1882 | { |
1879 | if (_badCharacter.Count > 0) | 1883 | if (_badCharacter.Count > 0) |