void factory_OnLinkPhase(BulletFactory obj) { if (rigidBodies.Count > 0) { TransformSimObject = rigidBodies[0].Owner.getOtherSimObject(transformSimObjectName); if (TransformSimObject == null) { SimObjectErrorManager.AddError(new SimObjectError() { SimObject = "TransformedBulletScene", Type = this.GetType().Name, Subsystem = BulletInterface.PluginName, ElementName = getName(), Message = String.Format("Cannot find Transform Target Sim Object named '{0}'.", transformSimObjectName) }); TransformSimObject = new GenericSimObject(getName() + "TransformedBulletScene_AutoCreatedSimObject", Vector3.Zero, Quaternion.Identity, Vector3.ScaleIdentity, true); } positionBroadcaster = TransformSimObject.getElement(positionBroadcasterName) as PositionBroadcaster; if (positionBroadcaster != null) { positionBroadcaster.PositionChanged += positionBroadcaster_PositionChanged; } else { SimObjectErrorManager.AddError(new SimObjectError() { SimObject = "TransformedBulletScene", Type = this.GetType().Name, Subsystem = BulletInterface.PluginName, ElementName = getName(), Message = String.Format("Cannot find PositionBroadcaster named '{0}' in Transform Target Sim Object '{1}'.", positionBroadcasterName, transformSimObjectName) }); } } else { SimObjectErrorManager.AddError(new SimObjectError() { SimObject = "TransformedBulletScene", Type = this.GetType().Name, Subsystem = BulletInterface.PluginName, ElementName = getName(), Message = "No Actors in Bullet Scene" }); TransformSimObject = new GenericSimObject(getName() + "TransformedBulletScene_AutoCreatedSimObject", Vector3.Zero, Quaternion.Identity, Vector3.ScaleIdentity, true); //Note that no position broadcaster is created here, the dummy sim object will not move so we don't actually care. //If you do decide to care add a PositionBroadcaster to the created TransformSimObject. This is really just an error state anyway, this behavior should not be used //create an actual simobject setup correctly to track if you are using this scene. } }
public unsafe BulletScene(BulletSceneDefinition definition, UpdateTimer timer) { callbackHandler = new CallbackHandler(); bulletScene = callbackHandler.create(this, definition); this.timer = timer; this.name = definition.Name; timer.addBackgroundUpdateListener("Rendering", this); factory = new BulletFactory(this); debugDraw = new BulletDebugDraw(); performanceName = String.Format("BulletScene {0} Background", name); Active = true; InternalTimestep = definition.InternalTimestep; SolverIterations = definition.SolverIterations; AutoSynchronizeAfterUpdate = true; }