From a572a22dd9fa6ae1b7fe8b3237decccc97af45fd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Jul 2016 21:29:34 +0100 Subject: [PATCH] ubOde try to improve contact velocity on first avatar collision with terrain --- OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index 55619c00f6..ccaff5e9b9 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -80,6 +80,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private Vector3 m_rotationalVelocity; private Vector3 m_size; private Vector3 m_collideNormal; + private Vector3 m_lastFallVel; private Quaternion m_orientation; private Quaternion m_orientation2D; private float m_mass = 80f; @@ -1114,7 +1115,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_iscollidingGround = true; - ContactPoint contact = new ContactPoint(); contact.PenetrationDepth = depth; contact.Position.X = localpos.X; @@ -1123,9 +1123,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde contact.SurfaceNormal.X = -n.X; contact.SurfaceNormal.Y = -n.Y; contact.SurfaceNormal.Z = -n.Z; - contact.RelativeSpeed = -vel.Z; + contact.RelativeSpeed = -Vector3.Dot(m_lastFallVel, contact.SurfaceNormal);; contact.CharacterFeet = true; AddCollisionEvent(0, contact); + m_lastFallVel = vel; // vec.Z *= 0.5f; } @@ -1133,6 +1134,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde else { + m_lastFallVel = vel; m_colliderGroundfilter -= 5; if (m_colliderGroundfilter <= 0) { @@ -1143,6 +1145,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else { + m_lastFallVel = vel; m_colliderGroundfilter -= 5; if (m_colliderGroundfilter <= 0) {