BulletSim: add position resetting for stationary avatars so they don't
move around when standing on a stationary object. Create proper linkage between BSCharacter and its actor by generating a UpdatedProperties event the same way BSPrim does.TeleportWork
parent
edef7472d1
commit
1d65b0d802
|
@ -130,6 +130,7 @@ public class BSActorAvatarMove : BSActor
|
|||
SetVelocityAndTarget(m_controllingPrim.RawVelocity, m_controllingPrim.TargetVelocity, true /* inTaintTime */);
|
||||
|
||||
m_physicsScene.BeforeStep += Mover;
|
||||
m_controllingPrim.OnPreUpdateProperty += Process_OnPreUpdateProperty;
|
||||
|
||||
m_walkingUpStairs = 0;
|
||||
}
|
||||
|
@ -139,6 +140,7 @@ public class BSActorAvatarMove : BSActor
|
|||
{
|
||||
if (m_velocityMotor != null)
|
||||
{
|
||||
m_controllingPrim.OnPreUpdateProperty -= Process_OnPreUpdateProperty;
|
||||
m_physicsScene.BeforeStep -= Mover;
|
||||
m_velocityMotor = null;
|
||||
}
|
||||
|
@ -197,7 +199,7 @@ public class BSActorAvatarMove : BSActor
|
|||
{
|
||||
if (m_controllingPrim.Flying)
|
||||
{
|
||||
// Flying and not collising and velocity nearly zero.
|
||||
// Flying and not colliding and velocity nearly zero.
|
||||
m_controllingPrim.ZeroMotion(true /* inTaintTime */);
|
||||
}
|
||||
}
|
||||
|
@ -266,6 +268,19 @@ public class BSActorAvatarMove : BSActor
|
|||
}
|
||||
}
|
||||
|
||||
// Called just as the property update is received from the physics engine.
|
||||
// Do any mode necessary for avatar movement.
|
||||
private void Process_OnPreUpdateProperty(ref EntityProperties entprop)
|
||||
{
|
||||
// Don't change position if standing on a stationary object.
|
||||
if (m_controllingPrim.IsStationary)
|
||||
{
|
||||
entprop.Position = m_controllingPrim.RawPosition;
|
||||
m_physicsScene.PE.SetTranslation(m_controllingPrim.PhysBody, entprop.Position, entprop.Rotation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Decide if the character is colliding with a low object and compute a force to pop the
|
||||
// avatar up so it can walk up and over the low objects.
|
||||
private OMV.Vector3 WalkUpStairs()
|
||||
|
|
|
@ -709,10 +709,10 @@ public sealed class BSCharacter : BSPhysObject
|
|||
// the world that things have changed.
|
||||
public override void UpdateProperties(EntityProperties entprop)
|
||||
{
|
||||
// Don't change position if standing on a stationary object.
|
||||
if (!IsStationary)
|
||||
RawPosition = entprop.Position;
|
||||
// Let anyone (like the actors) modify the updated properties before they are pushed into the object and the simulator.
|
||||
TriggerPreUpdatePropertyAction(ref entprop);
|
||||
|
||||
RawPosition = entprop.Position;
|
||||
RawOrientation = entprop.Rotation;
|
||||
|
||||
// Smooth velocity. OpenSimulator is VERY sensitive to changes in velocity of the avatar
|
||||
|
@ -740,7 +740,7 @@ public sealed class BSCharacter : BSPhysObject
|
|||
// Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this);
|
||||
|
||||
// Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop.
|
||||
// base.RequestPhysicsterseUpdate();
|
||||
// PhysScene.PostUpdate(this);
|
||||
|
||||
DetailLog("{0},BSCharacter.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}",
|
||||
LocalID, RawPosition, RawOrientation, RawVelocity, _acceleration, _rotationalVelocity);
|
||||
|
|
Loading…
Reference in New Issue