BulletSim: adjust avatar position when the avatar's size is changed.
This fixes the problem of avatars bouncing when logged in. Added a little height to the avatar height fudges to eliminate a problem of feet being in the ground a bit.0.7.6-extended
parent
9fc97cbbf7
commit
6410a25cef
|
@ -96,8 +96,8 @@ public sealed class BSCharacter : BSPhysObject
|
|||
m_moveActor = new BSActorAvatarMove(PhysScene, this, AvatarMoveActorName);
|
||||
PhysicalActors.Add(AvatarMoveActorName, m_moveActor);
|
||||
|
||||
DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}",
|
||||
LocalID, _size, Scale, Density, _avatarVolume, RawMass);
|
||||
DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5},pos={6}",
|
||||
LocalID, _size, Scale, Density, _avatarVolume, RawMass, pos);
|
||||
|
||||
// do actual creation in taint time
|
||||
PhysScene.TaintedObject("BSCharacter.create", delegate()
|
||||
|
@ -190,6 +190,10 @@ public sealed class BSCharacter : BSPhysObject
|
|||
}
|
||||
|
||||
set {
|
||||
// This is how much the avatar size is changing. Positive means getting bigger.
|
||||
// The avatar altitude must be adjusted for this change.
|
||||
float heightChange = value.Z - _size.Z;
|
||||
|
||||
_size = value;
|
||||
// Old versions of ScenePresence passed only the height. If width and/or depth are zero,
|
||||
// replace with the default values.
|
||||
|
@ -207,6 +211,10 @@ public sealed class BSCharacter : BSPhysObject
|
|||
{
|
||||
PhysScene.PE.SetLocalScaling(PhysShape.physShapeInfo, Scale);
|
||||
UpdatePhysicalMassProperties(RawMass, true);
|
||||
|
||||
// Adjust the avatar's position to account for the increase/decrease in size
|
||||
ForcePosition = new OMV.Vector3(RawPosition.X, RawPosition.Y, RawPosition.Z + heightChange / 2f);
|
||||
|
||||
// Make sure this change appears as a property update event
|
||||
PhysScene.PE.PushUpdate(PhysBody);
|
||||
}
|
||||
|
|
|
@ -570,9 +570,9 @@ public static class BSParam
|
|||
new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground",
|
||||
-0.2f ),
|
||||
new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground",
|
||||
0.1f ),
|
||||
0.2f ),
|
||||
new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground",
|
||||
0.1f ),
|
||||
0.2f ),
|
||||
new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
|
||||
0.1f ),
|
||||
new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground",
|
||||
|
|
Loading…
Reference in New Issue