mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
BulletSim: Fix single physical prim reporting its mass as zero.
Properly return root mass as mass of just the root prim rather than the mass of the linkset. SOG has the logic to add the masses together to get the linkset mass. Update TODO list.
This commit is contained in:
@@ -174,7 +174,7 @@ public sealed class BSCharacter : BSPhysObject
|
||||
BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, BSParam.CcdSweptSphereRadius);
|
||||
}
|
||||
|
||||
UpdatePhysicalMassProperties(RawMass);
|
||||
UpdatePhysicalMassProperties(RawMass, false);
|
||||
|
||||
// Make so capsule does not fall over
|
||||
BulletSimAPI.SetAngularFactorV2(PhysBody.ptr, OMV.Vector3.Zero);
|
||||
@@ -224,7 +224,7 @@ public sealed class BSCharacter : BSPhysObject
|
||||
if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape)
|
||||
{
|
||||
BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);
|
||||
UpdatePhysicalMassProperties(RawMass);
|
||||
UpdatePhysicalMassProperties(RawMass, true);
|
||||
// Make sure this change appears as a property update event
|
||||
BulletSimAPI.PushUpdate2(PhysBody.ptr);
|
||||
}
|
||||
@@ -390,7 +390,7 @@ public sealed class BSCharacter : BSPhysObject
|
||||
public override float RawMass {
|
||||
get {return _mass; }
|
||||
}
|
||||
public override void UpdatePhysicalMassProperties(float physMass)
|
||||
public override void UpdatePhysicalMassProperties(float physMass, bool inWorld)
|
||||
{
|
||||
OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass);
|
||||
BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, localInertia);
|
||||
@@ -772,8 +772,9 @@ public sealed class BSCharacter : BSPhysObject
|
||||
// the motor can be turned off. Set the velocity to zero so the zero motion is sent to the viewer.
|
||||
if (_velocityMotor.TargetValue.ApproxEquals(OMV.Vector3.Zero, 0.01f) && _velocityMotor.ErrorIsZero)
|
||||
{
|
||||
stepVelocity = OMV.Vector3.Zero;
|
||||
_velocityMotor.Enabled = false;
|
||||
stepVelocity = OMV.Vector3.Zero;
|
||||
ZeroMotion(true);
|
||||
DetailLog("{0},BSCharacter.UpdateProperties,taint,disableVelocityMotor,m={1}", LocalID, _velocityMotor);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user