BulletSim: protect prim property setting to remove crash from taints setting properties after the destroy object taint has happened.
parent
905d7c43ad
commit
63099184db
|
@ -65,7 +65,7 @@ public abstract class BSMotor
|
|||
// Can all the incremental stepping be replaced with motor classes?
|
||||
|
||||
// Motor which moves CurrentValue to TargetValue over TimeScale seconds.
|
||||
// The TargetValue is decays in TargetValueDecayTimeScale and
|
||||
// The TargetValue decays in TargetValueDecayTimeScale and
|
||||
// the CurrentValue will be held back by FrictionTimeScale.
|
||||
// TimeScale and TargetDelayTimeScale may be 'infinite' which means go decay.
|
||||
|
||||
|
|
|
@ -249,6 +249,7 @@ public sealed class BSPrim : BSPhysObject
|
|||
// Zero some other properties in the physics engine
|
||||
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate()
|
||||
{
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
BulletSimAPI.ClearAllForces2(PhysBody.ptr);
|
||||
});
|
||||
}
|
||||
|
@ -259,8 +260,11 @@ public sealed class BSPrim : BSPhysObject
|
|||
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate()
|
||||
{
|
||||
// DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity);
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
{
|
||||
BulletSimAPI.SetInterpolationAngularVelocity2(PhysBody.ptr, _rotationalVelocity);
|
||||
BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -297,8 +301,11 @@ public sealed class BSPrim : BSPhysObject
|
|||
PhysicsScene.TaintedObject("BSPrim.setPosition", delegate()
|
||||
{
|
||||
// DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
{
|
||||
BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
|
||||
ActivateIfPhysical(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -415,6 +422,7 @@ public sealed class BSPrim : BSPhysObject
|
|||
PhysicsScene.TaintedObject("BSPrim.setForce", delegate()
|
||||
{
|
||||
// DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force);
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force);
|
||||
});
|
||||
}
|
||||
|
@ -509,6 +517,7 @@ public sealed class BSPrim : BSPhysObject
|
|||
PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate()
|
||||
{
|
||||
// DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity);
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity);
|
||||
});
|
||||
}
|
||||
|
@ -557,10 +566,13 @@ public sealed class BSPrim : BSPhysObject
|
|||
_orientation = value;
|
||||
// TODO: what does it mean if a child in a linkset changes its orientation? Rebuild the constraint?
|
||||
PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate()
|
||||
{
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
{
|
||||
// _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr);
|
||||
// DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation);
|
||||
BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -865,6 +877,7 @@ public sealed class BSPrim : BSPhysObject
|
|||
PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate()
|
||||
{
|
||||
DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity);
|
||||
});
|
||||
}
|
||||
|
@ -900,10 +913,13 @@ public sealed class BSPrim : BSPhysObject
|
|||
_buoyancy = value;
|
||||
// DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
|
||||
// Buoyancy is faked by changing the gravity applied to the object
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
{
|
||||
float grav = PhysicsScene.Params.gravity * (1f - _buoyancy);
|
||||
BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Used for MoveTo
|
||||
public override OMV.Vector3 PIDTarget {
|
||||
|
@ -969,6 +985,7 @@ public sealed class BSPrim : BSPhysObject
|
|||
}
|
||||
DetailLog("{0},BSPrim.AddForce,taint,force={1}", LocalID, fSum);
|
||||
if (fSum != OMV.Vector3.Zero)
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, fSum);
|
||||
});
|
||||
}
|
||||
|
@ -980,6 +997,7 @@ public sealed class BSPrim : BSPhysObject
|
|||
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyForceImpulse", delegate()
|
||||
{
|
||||
DetailLog("{0},BSPrim.ApplyForceImpulse,taint,tImpulse={1}", LocalID, applyImpulse);
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
BulletSimAPI.ApplyCentralImpulse2(PhysBody.ptr, applyImpulse);
|
||||
});
|
||||
}
|
||||
|
@ -1016,6 +1034,7 @@ public sealed class BSPrim : BSPhysObject
|
|||
DetailLog("{0},BSPrim.AddAngularForce,taint,aForce={1}", LocalID, fSum);
|
||||
if (fSum != OMV.Vector3.Zero)
|
||||
{
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
BulletSimAPI.ApplyTorque2(PhysBody.ptr, fSum);
|
||||
_torque = fSum;
|
||||
}
|
||||
|
@ -1030,6 +1049,7 @@ public sealed class BSPrim : BSPhysObject
|
|||
OMV.Vector3 applyImpulse = impulse;
|
||||
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyTorqueImpulse", delegate()
|
||||
{
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
BulletSimAPI.ApplyTorqueImpulse2(PhysBody.ptr, applyImpulse);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,12 +11,14 @@ CRASHES
|
|||
|
||||
VEHICLES TODO LIST:
|
||||
=================================================
|
||||
Neb car jiggling left and right
|
||||
Happens on terrain and any other mesh object. Flat cubes are much smoother.
|
||||
Neb vehicle taking > 25ms of physics time!!
|
||||
Vehicles (Move smoothly)
|
||||
Add vehicle collisions so IsColliding is properly reported.
|
||||
Needed for banking, limitMotorUp, movementLimiting, ...
|
||||
Some vehicles should not be able to turn if no speed or off ground.
|
||||
Neb car jiggling left and right
|
||||
Happens on terrain and any other mesh object. Flat cubes are much smoother.
|
||||
This has been reduced but not eliminated.
|
||||
For limitMotorUp, use raycast down to find if vehicle is in the air.
|
||||
Implement function efficiency for lineaar and angular motion.
|
||||
Should vehicle angular/linear movement friction happen after all the components
|
||||
|
@ -30,6 +32,9 @@ Border crossing with linked vehicle causes crash
|
|||
|
||||
BULLETSIM TODO LIST:
|
||||
=================================================
|
||||
Avatar height off after unsitting (float off ground)
|
||||
Editting appearance then moving restores.
|
||||
Must not be initializing height when recreating capsule after unsit.
|
||||
Duplicating a physical prim causes old prim to jump away
|
||||
Dup a phys prim and the original become unselected and thus interacts w/ selected prim.
|
||||
Disable activity of passive linkset children.
|
||||
|
|
Loading…
Reference in New Issue