BulletSim: add physical object initialized flag so updates and collisions

don't happen until the object is completely initialized.

This fixes the problem of doing a teleport while the simulator is running.
The destruction of the physical object while the engine is running means
that the physics parameter update would overwrite the new position of the
newly created avatar.
This commit is contained in:
Robert Adams
2013-08-14 14:13:08 -07:00
parent 93dffe1777
commit 7c3b71d294
5 changed files with 23 additions and 5 deletions

View File

@@ -72,6 +72,8 @@ public abstract class BSPhysObject : PhysicsActor
}
protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
{
IsInitialized = false;
PhysScene = parentScene;
LocalID = localID;
PhysObjectName = name;
@@ -130,6 +132,8 @@ public abstract class BSPhysObject : PhysicsActor
public string PhysObjectName { get; protected set; }
public string TypeName { get; protected set; }
// Set to 'true' when the object is completely initialized
public bool IsInitialized { get; protected set; }
// Return the object mass without calculating it or having side effects
public abstract float RawMass { get; }