Bulletsim: Create AvatarTerminalVelocity to BulletSim like what ODE and SL has. Before this falling from really high caused the avatar to fall faster then the veiwer can handle and cause camera issues.
parent
8542f34d7d
commit
ed6aabb197
|
@ -205,6 +205,17 @@ public class BSActorAvatarMove : BSActor
|
||||||
// Flying and not colliding and velocity nearly zero.
|
// Flying and not colliding and velocity nearly zero.
|
||||||
m_controllingPrim.ZeroMotion(true /* inTaintTime */);
|
m_controllingPrim.ZeroMotion(true /* inTaintTime */);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//We are falling but are not touching any keys make sure not falling too fast
|
||||||
|
if (m_controllingPrim.RawVelocity.Z < BSParam.AvatarTerminalVelocity)
|
||||||
|
{
|
||||||
|
|
||||||
|
OMV.Vector3 slowingForce = new OMV.Vector3(0f, 0f, BSParam.AvatarTerminalVelocity - m_controllingPrim.RawVelocity.Z) * m_controllingPrim.Mass;
|
||||||
|
m_physicsScene.PE.ApplyCentralImpulse(m_controllingPrim.PhysBody, slowingForce);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1},colliding={2}",
|
m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1},colliding={2}",
|
||||||
|
@ -252,8 +263,17 @@ public class BSActorAvatarMove : BSActor
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Since we're not affected by anything, whatever vertical motion the avatar has, continue that.
|
|
||||||
stepVelocity.Z = m_controllingPrim.RawVelocity.Z;
|
// Since we're not affected by anything, the avatar must be falling and we do not want that to be too fast.
|
||||||
|
if (m_controllingPrim.RawVelocity.Z < BSParam.AvatarTerminalVelocity)
|
||||||
|
{
|
||||||
|
|
||||||
|
stepVelocity.Z = BSParam.AvatarTerminalVelocity;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stepVelocity.Z = m_controllingPrim.RawVelocity.Z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity);
|
// DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,6 +138,7 @@ public static class BSParam
|
||||||
public static float AvatarHeightHighFudge { get; private set; }
|
public static float AvatarHeightHighFudge { get; private set; }
|
||||||
public static float AvatarFlyingGroundMargin { get; private set; }
|
public static float AvatarFlyingGroundMargin { get; private set; }
|
||||||
public static float AvatarFlyingGroundUpForce { get; private set; }
|
public static float AvatarFlyingGroundUpForce { get; private set; }
|
||||||
|
public static float AvatarTerminalVelocity { get; private set; }
|
||||||
public static float AvatarContactProcessingThreshold { get; private set; }
|
public static float AvatarContactProcessingThreshold { get; private set; }
|
||||||
public static float AvatarStopZeroThreshold { get; private set; }
|
public static float AvatarStopZeroThreshold { get; private set; }
|
||||||
public static int AvatarJumpFrames { get; private set; }
|
public static int AvatarJumpFrames { get; private set; }
|
||||||
|
@ -589,6 +590,8 @@ public static class BSParam
|
||||||
5f ),
|
5f ),
|
||||||
new ParameterDefn<float>("AvatarFlyingGroundUpForce", "Upward force applied to the avatar to keep it at flying ground margin",
|
new ParameterDefn<float>("AvatarFlyingGroundUpForce", "Upward force applied to the avatar to keep it at flying ground margin",
|
||||||
2.0f ),
|
2.0f ),
|
||||||
|
new ParameterDefn<float>("AvatarTerminalVelocity", "Terminal Velocity of falling avatar",
|
||||||
|
-54.0f ),
|
||||||
new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
|
new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
|
||||||
0.1f ),
|
0.1f ),
|
||||||
new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped",
|
new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped",
|
||||||
|
|
|
@ -1038,6 +1038,11 @@
|
||||||
AvatarHeightMidFudge = 0 ; Adjustment at mid point of avatar height range
|
AvatarHeightMidFudge = 0 ; Adjustment at mid point of avatar height range
|
||||||
AvatarHeightHighFudge = 0 ; Adjustment at high end of height range
|
AvatarHeightHighFudge = 0 ; Adjustment at high end of height range
|
||||||
|
|
||||||
|
; Terminal velocity of a falling avatar
|
||||||
|
; This is the same http://en.wikipedia.org/wiki/Terminal_velocity#Examples
|
||||||
|
; negative for a downward speed.
|
||||||
|
AvatarTerminalVelocity = -54
|
||||||
|
|
||||||
; Default linkset implmentation
|
; Default linkset implmentation
|
||||||
; 'Constraint' uses physics constraints to hold linkset together. 'Compound'
|
; 'Constraint' uses physics constraints to hold linkset together. 'Compound'
|
||||||
; builds a compound shape from the children shapes to create a single physical
|
; builds a compound shape from the children shapes to create a single physical
|
||||||
|
|
Loading…
Reference in New Issue