void MagnetDetachObject(MagnetObjectItem item) { item.fixedJoint.Dispose(); UnsubscribeToDeletionEvent(item.mapObject); magnetAttachedObjects.Remove(item); }
void CreateFixedJointForAttachedObject(MagnetObjectItem item) { FixedJoint fixedJoint = PhysicsWorld.Instance.CreateFixedJoint(magnetBody, item.body); fixedJoint.PushedToWorld = true; item.fixedJoint = fixedJoint; }
void MagnetAttachObject(Body mapObjectBody) { if (mapObjectBody.IsDisposed) { return; } if (IsMagnetBodyAttached(mapObjectBody)) { Log.Fatal("Crane: MagnetAttachObject: IsMagnetBodyAttached( mapObjectBody )."); } MapObject mapObject = MapSystemWorld.GetMapObjectByBody(mapObjectBody); if (mapObject != null && mapObject.PhysicsModel != null) { MagnetObjectItem item = new MagnetObjectItem(); item.mapObject = mapObject; item.body = mapObjectBody; item.bodyIndex = Array.IndexOf <Body>(mapObject.PhysicsModel.Bodies, mapObjectBody); SubscribeToDeletionEvent(mapObject); CreateFixedJointForAttachedObject(item); magnetAttachedObjects.Add(item); } }
void MagnetDetachObject(MagnetObjectItem item) { item.fixedJoint.Dispose(); RemoveRelationship(item.mapObject); magnetAttachedObjects.Remove(item); }
void MagnetAttachObject(Body mapObjectBody) { if (mapObjectBody.IsDisposed) { return; } Trace.Assert(!IsMagnetBodyAttached(mapObjectBody)); MapObject mapObject = MapSystemWorld.GetMapObjectByBody(mapObjectBody); if (mapObject == null) { return; } MagnetObjectItem item = new MagnetObjectItem(); item.mapObject = mapObject; item.body = mapObjectBody; item.bodyIndex = Array.IndexOf <Body>(mapObject.PhysicsModel.Bodies, mapObjectBody); AddRelationship(mapObject); CreateFixedJointForAttachedObject(item); magnetAttachedObjects.Add(item); }
void MagnetDetachObject( MagnetObjectItem item ) { item.fixedJoint.Dispose(); RemoveRelationship( item.mapObject ); magnetAttachedObjects.Remove( item ); }
void MagnetAttachObject( Body mapObjectBody ) { if( mapObjectBody.IsDisposed ) return; Trace.Assert( !IsMagnetBodyAttached( mapObjectBody ) ); MapObject mapObject = MapSystemWorld.GetMapObjectByBody( mapObjectBody ); if( mapObject == null ) return; MagnetObjectItem item = new MagnetObjectItem(); item.mapObject = mapObject; item.body = mapObjectBody; item.bodyIndex = Array.IndexOf<Body>( mapObject.PhysicsModel.Bodies, mapObjectBody ); AddRelationship( mapObject ); CreateFixedJointForAttachedObject( item ); magnetAttachedObjects.Add( item ); }
void CreateFixedJointForAttachedObject( MagnetObjectItem item ) { FixedJoint fixedJoint = PhysicsWorld.Instance.CreateFixedJoint( magnetBody, item.body ); fixedJoint.PushedToWorld = true; item.fixedJoint = fixedJoint; }
void MagnetDetachObject( MagnetObjectItem item ) { item.fixedJoint.Dispose(); UnsubscribeToDeletionEvent( item.mapObject ); magnetAttachedObjects.Remove( item ); }
void MagnetAttachObject( Body mapObjectBody ) { if( mapObjectBody.IsDisposed ) return; if( IsMagnetBodyAttached( mapObjectBody ) ) Log.Fatal( "Crane: MagnetAttachObject: IsMagnetBodyAttached( mapObjectBody )." ); MapObject mapObject = MapSystemWorld.GetMapObjectByBody( mapObjectBody ); if( mapObject != null && mapObject.PhysicsModel != null ) { MagnetObjectItem item = new MagnetObjectItem(); item.mapObject = mapObject; item.body = mapObjectBody; item.bodyIndex = Array.IndexOf<Body>( mapObject.PhysicsModel.Bodies, mapObjectBody ); SubscribeToDeletionEvent( mapObject ); CreateFixedJointForAttachedObject( item ); magnetAttachedObjects.Add( item ); } }