From f49897a4195df5fbd00e2c16461bcebb36ce8f72 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 11 Feb 2012 02:26:53 +0000 Subject: Clamp ODE character velocity. Make ODE falling character 54m/s by default. If velocity reaches 256 in any vector then bad things happen with ODE, so we now clamp this value. In addition, a falling avatar is clamped by default at 54 m/s, which is the same as a falling skydiver. This also appears to be the value used on the linden lab grid. This should resolve http://opensimulator.org/mantis/view.php?id=5882 --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Region/Physics/OdePlugin/OdeScene.cs') diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 4530c09..7d1401c 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -144,6 +144,8 @@ namespace OpenSim.Region.Physics.OdePlugin public float gravityy = 0f; public float gravityz = -9.8f; + public float AvatarTerminalVelocity { get; set; } + private float contactsurfacelayer = 0.001f; private int worldHashspaceLow = -4; @@ -459,6 +461,15 @@ namespace OpenSim.Region.Physics.OdePlugin gravityy = physicsconfig.GetFloat("world_gravityy", 0f); gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f); + float avatarTerminalVelocity = physicsconfig.GetFloat("avatar_terminal_velocity", 9f); + AvatarTerminalVelocity = Util.Clamp(avatarTerminalVelocity, 0, 255f); + if (AvatarTerminalVelocity != avatarTerminalVelocity) + { + m_log.WarnFormat( + "[ODE SCENE]: avatar_terminal_velocity of {0} is invalid. Clamping to {1}", + avatarTerminalVelocity, AvatarTerminalVelocity); + } + worldHashspaceLow = physicsconfig.GetInt("world_hashspace_size_low", -4); worldHashspaceHigh = physicsconfig.GetInt("world_hashspace_size_high", 128); -- cgit v1.1 From b92b9228ef5c7833dac019aba12babb5df954d35 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 11 Feb 2012 02:29:07 +0000 Subject: correct the default avatar_terminal_velocity value that I accidentally left in whilst testing --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/OdePlugin/OdeScene.cs') diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 7d1401c..598530c 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -461,7 +461,7 @@ namespace OpenSim.Region.Physics.OdePlugin gravityy = physicsconfig.GetFloat("world_gravityy", 0f); gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f); - float avatarTerminalVelocity = physicsconfig.GetFloat("avatar_terminal_velocity", 9f); + float avatarTerminalVelocity = physicsconfig.GetFloat("avatar_terminal_velocity", 54f); AvatarTerminalVelocity = Util.Clamp(avatarTerminalVelocity, 0, 255f); if (AvatarTerminalVelocity != avatarTerminalVelocity) { -- cgit v1.1