Add upward force to flight when close to the ground. Prevents current belly flop to the floor when flying with bullet physics and acts more like ODE and SL flight.
Signed-off-by: Michael Cerquoni <nebadon2025@gmail.com>0.8.0.3
parent
eea3be9b17
commit
fa1f6031ca
|
@ -139,6 +139,21 @@ public class BSActorAvatarMove : BSActor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float ComputeMinFlightHeight()
|
||||||
|
{
|
||||||
|
float waterHeight = m_physicsScene.TerrainManager.GetWaterLevelAtXYZ(m_controllingPrim.RawPosition);
|
||||||
|
float groundHeight = m_physicsScene.TerrainManager.GetTerrainHeightAtXYZ(m_controllingPrim.RawPosition);
|
||||||
|
|
||||||
|
if (groundHeight > waterHeight)
|
||||||
|
{
|
||||||
|
return groundHeight + 8f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return waterHeight + 8f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DeactivateAvatarMove()
|
private void DeactivateAvatarMove()
|
||||||
{
|
{
|
||||||
if (m_velocityMotor != null)
|
if (m_velocityMotor != null)
|
||||||
|
@ -265,6 +280,17 @@ public class BSActorAvatarMove : BSActor
|
||||||
// Add special movement force to allow avatars to walk up stepped surfaces.
|
// Add special movement force to allow avatars to walk up stepped surfaces.
|
||||||
moveForce += WalkUpStairs();
|
moveForce += WalkUpStairs();
|
||||||
|
|
||||||
|
//Alicia: Maintain minimum height when flying
|
||||||
|
if (m_controllingPrim.Flying)
|
||||||
|
{
|
||||||
|
float hover_height = ComputeMinFlightHeight();
|
||||||
|
|
||||||
|
if( m_controllingPrim.Position.Z < hover_height)
|
||||||
|
{
|
||||||
|
moveForce.Z = moveForce.Z + 50f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}",
|
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_controllingPrim.LocalID, stepVelocity, m_controllingPrim.RawVelocity, m_controllingPrim.Mass, moveForce);
|
||||||
m_physicsScene.PE.ApplyCentralImpulse(m_controllingPrim.PhysBody, moveForce);
|
m_physicsScene.PE.ApplyCentralImpulse(m_controllingPrim.PhysBody, moveForce);
|
||||||
|
|
Loading…
Reference in New Issue