From f348928590de1b7044801f72d3c415cb10175d45 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 18 Jun 2014 22:39:28 -0700 Subject: BulletSim: more tweeks to AliciaRaven's flying mods. Added parameters AvatarFlyingGroundMargin and AvatarFlyingGroundUpForce set to 5.0 and 2.0 respectively which seems to give about the same action as in SL. Also moved force addition to before the velocity to force computation so the upward velocity is properly applied to the avatar mass. --- .../Physics/BulletSPlugin/BSActorAvatarMove.cs | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs index 557c4e2..42381ef 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -227,7 +227,6 @@ public class BSActorAvatarMove : BSActor stepVelocity.Z = m_controllingPrim.RawVelocity.Z; } - // Colliding and not flying with an upward force. The avatar must be trying to jump. if (!m_controllingPrim.Flying && m_controllingPrim.IsColliding && stepVelocity.Z > 0) { @@ -259,23 +258,25 @@ public class BSActorAvatarMove : BSActor // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity); } - // 'stepVelocity' is now the speed we'd like the avatar to move in. Turn that into an instantanous force. - OMV.Vector3 moveForce = (stepVelocity - m_controllingPrim.RawVelocity) * m_controllingPrim.Mass; - - // Add special movement force to allow avatars to walk up stepped surfaces. - moveForce += WalkUpStairs(); - - //Alicia: Maintain minimum height when flying + //Alicia: Maintain minimum height when flying. + // SL has a flying effect that keeps the avatar flying above the ground by some margin if (m_controllingPrim.Flying) { - float hover_height = m_physicsScene.TerrainManager.GetTerrainHeightAtXYZ(m_controllingPrim.RawPosition) + 8f; + float hover_height = m_physicsScene.TerrainManager.GetTerrainHeightAtXYZ(m_controllingPrim.RawPosition) + + BSParam.AvatarFlyingGroundMargin; if( m_controllingPrim.Position.Z < hover_height) { - moveForce.Z = moveForce.Z + 50f; + stepVelocity.Z += BSParam.AvatarFlyingGroundUpForce; } } + // 'stepVelocity' is now the speed we'd like the avatar to move in. Turn that into an instantanous force. + OMV.Vector3 moveForce = (stepVelocity - m_controllingPrim.RawVelocity) * m_controllingPrim.Mass; + + // Add special movement force to allow avatars to walk up stepped surfaces. + moveForce += WalkUpStairs(); + m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", m_controllingPrim.LocalID, stepVelocity, m_controllingPrim.RawVelocity, m_controllingPrim.Mass, moveForce); m_physicsScene.PE.ApplyCentralImpulse(m_controllingPrim.PhysBody, moveForce); -- cgit v1.1