From fff5c61ae83ad54eaff640d2868186d275f3dd62 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 16 Apr 2012 17:47:17 +0100 Subject: [PATCH] chODE: if character velocity > 50m/s apply breaks. In free fall this will give a terminal velocity +- 60m/s --- OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs index c53ccecf75..ec717d73b0 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs @@ -1122,9 +1122,18 @@ namespace OpenSim.Region.Physics.OdePlugin } // end add Kitto Flora } + + if (vel.X * vel.X + vel.Y * vel.Y + vel.Z * vel.Z > 2500.0f) // 50ms apply breaks + { + float breakfactor = 0.16f * m_mass; // will give aprox 60m/s terminal velocity at free fall + vec.X -= breakfactor * vel.X; + vec.Y -= breakfactor * vel.Y; + vec.Z -= breakfactor * vel.Z; + } + if (vec.IsFinite()) { - if (!vec.ApproxEquals(Vector3.Zero, 0.02f)) // 0.01 allows 0.002 !! + if (vec.LengthSquared() > 0.0004f) // 0.01 allows 0.002 !! { //Console.WriteLine("DF 2"); // ##