BulletSim: make collision sounds work most of the time. Seems that collisions
usually stop the collider so velocity is often small. Also remove some chatty debug messages.LSLKeyTest
parent
ddd59fab5f
commit
33af419050
|
@ -140,7 +140,7 @@ public class BSActorAvatarMove : BSActor
|
||||||
1f // efficiency
|
1f // efficiency
|
||||||
);
|
);
|
||||||
m_velocityMotor.ErrorZeroThreshold = BSParam.AvatarStopZeroThreshold;
|
m_velocityMotor.ErrorZeroThreshold = BSParam.AvatarStopZeroThreshold;
|
||||||
m_velocityMotor.PhysicsScene = m_controllingPrim.PhysScene; // DEBUG DEBUG so motor will output detail log messages.
|
// m_velocityMotor.PhysicsScene = m_controllingPrim.PhysScene; // DEBUG DEBUG so motor will output detail log messages.
|
||||||
SetVelocityAndTarget(m_controllingPrim.RawVelocity, m_controllingPrim.TargetVelocity, true /* inTaintTime */);
|
SetVelocityAndTarget(m_controllingPrim.RawVelocity, m_controllingPrim.TargetVelocity, true /* inTaintTime */);
|
||||||
|
|
||||||
m_physicsScene.BeforeStep += Mover;
|
m_physicsScene.BeforeStep += Mover;
|
||||||
|
|
|
@ -89,6 +89,7 @@ public sealed class BSCharacter : BSPhysObject
|
||||||
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
|
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
|
||||||
Friction = BSParam.AvatarStandingFriction;
|
Friction = BSParam.AvatarStandingFriction;
|
||||||
Density = BSParam.AvatarDensity;
|
Density = BSParam.AvatarDensity;
|
||||||
|
_isPhysical = true;
|
||||||
|
|
||||||
// Old versions of ScenePresence passed only the height. If width and/or depth are zero,
|
// Old versions of ScenePresence passed only the height. If width and/or depth are zero,
|
||||||
// replace with the default values.
|
// replace with the default values.
|
||||||
|
|
|
@ -505,17 +505,20 @@ public abstract class BSPhysObject : PhysicsActor
|
||||||
// Collision sound requires a velocity to know it should happen. This is a lot of computation for a little used feature.
|
// Collision sound requires a velocity to know it should happen. This is a lot of computation for a little used feature.
|
||||||
OMV.Vector3 relvel = OMV.Vector3.Zero;
|
OMV.Vector3 relvel = OMV.Vector3.Zero;
|
||||||
if (IsPhysical)
|
if (IsPhysical)
|
||||||
relvel = Velocity;
|
relvel = RawVelocity;
|
||||||
if (collidee != null && collidee.IsPhysical)
|
if (collidee != null && collidee.IsPhysical)
|
||||||
relvel -= collidee.Velocity;
|
relvel -= collidee.RawVelocity;
|
||||||
newContact.RelativeSpeed = OMV.Vector3.Dot(relvel, contactNormal);
|
newContact.RelativeSpeed = OMV.Vector3.Dot(relvel, contactNormal);
|
||||||
|
// DetailLog("{0},{1}.Collision.AddCollider,vel={2},contee.vel={3},relvel={4},relspeed={5}",
|
||||||
|
// LocalID, TypeName, RawVelocity, (collidee == null ? OMV.Vector3.Zero : collidee.RawVelocity), relvel, newContact.RelativeSpeed);
|
||||||
|
|
||||||
lock (PhysScene.CollisionLock)
|
lock (PhysScene.CollisionLock)
|
||||||
{
|
{
|
||||||
CollisionCollection.AddCollider(collideeLocalID, newContact);
|
CollisionCollection.AddCollider(collideeLocalID, newContact);
|
||||||
}
|
}
|
||||||
DetailLog("{0},{1}.Collision.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}",
|
DetailLog("{0},{1}.Collision.AddCollider,call,with={2},point={3},normal={4},depth={5},speed={6},colliderMoving={7}",
|
||||||
LocalID, TypeName, collideeLocalID, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving);
|
LocalID, TypeName, collideeLocalID, contactPoint, contactNormal, pentrationDepth,
|
||||||
|
newContact.RelativeSpeed, ColliderIsMoving);
|
||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue