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
Robert Adams 2016-01-19 22:09:51 -08:00
parent ddd59fab5f
commit 33af419050
3 changed files with 9 additions and 5 deletions

View File

@ -140,7 +140,7 @@ public class BSActorAvatarMove : BSActor
1f // efficiency
);
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 */);
m_physicsScene.BeforeStep += Mover;

View File

@ -89,6 +89,7 @@ public sealed class BSCharacter : BSPhysObject
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
Friction = BSParam.AvatarStandingFriction;
Density = BSParam.AvatarDensity;
_isPhysical = true;
// Old versions of ScenePresence passed only the height. If width and/or depth are zero,
// replace with the default values.

View File

@ -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.
OMV.Vector3 relvel = OMV.Vector3.Zero;
if (IsPhysical)
relvel = Velocity;
relvel = RawVelocity;
if (collidee != null && collidee.IsPhysical)
relvel -= collidee.Velocity;
relvel -= collidee.RawVelocity;
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)
{
CollisionCollection.AddCollider(collideeLocalID, newContact);
}
DetailLog("{0},{1}.Collision.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}",
LocalID, TypeName, collideeLocalID, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving);
DetailLog("{0},{1}.Collision.AddCollider,call,with={2},point={3},normal={4},depth={5},speed={6},colliderMoving={7}",
LocalID, TypeName, collideeLocalID, contactPoint, contactNormal, pentrationDepth,
newContact.RelativeSpeed, ColliderIsMoving);
ret = true;
}