diff options
author | Melanie | 2012-04-17 01:50:49 +0100 |
---|---|---|
committer | Melanie | 2012-04-17 01:50:49 +0100 |
commit | ab1a3688e24db08071f74c9804d552d5763bbeb2 (patch) | |
tree | 030bafc8ce646fbf80bd20a1e7647618222e7fc2 /OpenSim/Region/Physics/ChOdePlugin | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Merge branch 'ubitwork' (diff) | |
download | opensim-SC-ab1a3688e24db08071f74c9804d552d5763bbeb2.zip opensim-SC-ab1a3688e24db08071f74c9804d552d5763bbeb2.tar.gz opensim-SC-ab1a3688e24db08071f74c9804d552d5763bbeb2.tar.bz2 opensim-SC-ab1a3688e24db08071f74c9804d552d5763bbeb2.tar.xz |
Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into careminster
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs index 2945199..ec717d7 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs | |||
@@ -140,6 +140,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
140 | public int m_eventsubscription = 0; | 140 | public int m_eventsubscription = 0; |
141 | private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); | 141 | private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); |
142 | 142 | ||
143 | private Vector3 m_taintMomentum = Vector3.Zero; | ||
144 | private bool m_haveTaintMomentum = false; | ||
145 | |||
146 | |||
143 | // unique UUID of this character object | 147 | // unique UUID of this character object |
144 | public UUID m_uuid; | 148 | public UUID m_uuid; |
145 | public bool bad = false; | 149 | public bool bad = false; |
@@ -800,8 +804,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
800 | { | 804 | { |
801 | if (value.IsFinite()) | 805 | if (value.IsFinite()) |
802 | { | 806 | { |
803 | m_pidControllerActive = true; | ||
804 | _target_velocity = value; | 807 | _target_velocity = value; |
808 | m_pidControllerActive = true; | ||
805 | } | 809 | } |
806 | else | 810 | else |
807 | { | 811 | { |
@@ -911,6 +915,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
911 | 915 | ||
912 | public override void SetMomentum(Vector3 momentum) | 916 | public override void SetMomentum(Vector3 momentum) |
913 | { | 917 | { |
918 | if (momentum.IsFinite()) | ||
919 | { | ||
920 | m_taintMomentum = momentum; | ||
921 | m_haveTaintMomentum = true; | ||
922 | _parent_scene.AddPhysicsActorTaint(this); | ||
923 | } | ||
924 | else | ||
925 | m_log.Warn("[PHYSICS] !isFinite momentum"); | ||
914 | } | 926 | } |
915 | 927 | ||
916 | 928 | ||
@@ -1110,9 +1122,18 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1110 | } | 1122 | } |
1111 | // end add Kitto Flora | 1123 | // end add Kitto Flora |
1112 | } | 1124 | } |
1125 | |||
1126 | if (vel.X * vel.X + vel.Y * vel.Y + vel.Z * vel.Z > 2500.0f) // 50ms apply breaks | ||
1127 | { | ||
1128 | float breakfactor = 0.16f * m_mass; // will give aprox 60m/s terminal velocity at free fall | ||
1129 | vec.X -= breakfactor * vel.X; | ||
1130 | vec.Y -= breakfactor * vel.Y; | ||
1131 | vec.Z -= breakfactor * vel.Z; | ||
1132 | } | ||
1133 | |||
1113 | if (vec.IsFinite()) | 1134 | if (vec.IsFinite()) |
1114 | { | 1135 | { |
1115 | if (!vec.ApproxEquals(Vector3.Zero, 0.02f)) // 0.01 allows 0.002 !! | 1136 | if (vec.LengthSquared() > 0.0004f) // 0.01 allows 0.002 !! |
1116 | { | 1137 | { |
1117 | //Console.WriteLine("DF 2"); // ## | 1138 | //Console.WriteLine("DF 2"); // ## |
1118 | 1139 | ||
@@ -1327,7 +1348,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1327 | { | 1348 | { |
1328 | lock (m_syncRoot) | 1349 | lock (m_syncRoot) |
1329 | { | 1350 | { |
1330 | |||
1331 | if (m_tainted_isPhysical != m_isPhysical) | 1351 | if (m_tainted_isPhysical != m_isPhysical) |
1332 | { | 1352 | { |
1333 | if (m_tainted_isPhysical) | 1353 | if (m_tainted_isPhysical) |
@@ -1369,9 +1389,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1369 | { | 1389 | { |
1370 | d.GeomDestroy(Shell); | 1390 | d.GeomDestroy(Shell); |
1371 | } | 1391 | } |
1372 | catch (System.AccessViolationException) | 1392 | catch (Exception e) |
1373 | { | 1393 | { |
1374 | m_log.Error("[PHYSICS]: PrimGeom dead"); | 1394 | m_log.ErrorFormat("[PHYSICS]: Failed to destroy character shell {0}",e.Message); |
1375 | } | 1395 | } |
1376 | // Remove any old entries | 1396 | // Remove any old entries |
1377 | //string tShell; | 1397 | //string tShell; |
@@ -1418,12 +1438,21 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1418 | { | 1438 | { |
1419 | d.BodySetPosition(Body, m_taintPosition.X, m_taintPosition.Y, m_taintPosition.Z); | 1439 | d.BodySetPosition(Body, m_taintPosition.X, m_taintPosition.Y, m_taintPosition.Z); |
1420 | 1440 | ||
1421 | _position.X = m_taintPosition.X; | ||
1422 | _position.Y = m_taintPosition.Y; | ||
1423 | _position.Z = m_taintPosition.Z; | ||
1424 | } | 1441 | } |
1442 | _position.X = m_taintPosition.X; | ||
1443 | _position.Y = m_taintPosition.Y; | ||
1444 | _position.Z = m_taintPosition.Z; | ||
1425 | } | 1445 | } |
1426 | 1446 | ||
1447 | if (m_haveTaintMomentum) | ||
1448 | { | ||
1449 | m_haveTaintMomentum = false; | ||
1450 | _velocity = m_taintMomentum; | ||
1451 | _target_velocity = m_taintMomentum; | ||
1452 | m_pidControllerActive = true; | ||
1453 | if (Body != IntPtr.Zero) | ||
1454 | d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); | ||
1455 | } | ||
1427 | } | 1456 | } |
1428 | } | 1457 | } |
1429 | 1458 | ||