BulletSim: Fix linkset crash. Caused by the different body and shape

pointers at runtime and at taint-time. Now passes the body into the
    taint.
Vehicles zero inertia when active to eliminate Bullet's contribution
    to vehicle motion.
This commit is contained in:
Robert Adams
2012-09-27 08:23:29 -07:00
parent 4589bc84a3
commit f82b903dee
9 changed files with 182 additions and 94 deletions

View File

@@ -135,8 +135,11 @@ public abstract class BSPhysObject : PhysicsActor
// collision event to make collision_end work.
// Called at taint time from within the Step() function thus no locking problems
// with CollisionCollection and ObjectsWithNoMoreCollisions.
public virtual void SendCollisions()
// Return 'true' if there were some actual collisions passed up
public virtual bool SendCollisions()
{
bool ret = true;
// throttle the collisions to the number of milliseconds specified in the subscription
int nowTime = PhysicsScene.SimulationNowTime;
if (nowTime >= NextCollisionOkTime)
@@ -148,7 +151,7 @@ public abstract class BSPhysObject : PhysicsActor
if (CollisionCollection.Count == 0)
{
// If I have no collisions this time, remove me from the list of objects with collisions.
PhysicsScene.ObjectsWithNoMoreCollisions.Add(this);
ret = false;
}
// DetailLog("{0},{1}.SendCollisionUpdate,call,numCollisions={2}", LocalID, TypeName, CollisionCollection.Count);
@@ -158,6 +161,7 @@ public abstract class BSPhysObject : PhysicsActor
// Make sure we don't have a handle to that one and that a new one is used for next time.
CollisionCollection = new CollisionEventUpdate();
}
return ret;
}
// Subscribe for collision events.