internal override void createProduct(SimObjectBase instance, BEPUikScene scene) { BEPUikBone connectionA = null; BEPUikBone connectionB = null; SimObject other = instance.getOtherSimObject(ConnectionASimObjectName); if (other == null) { throw new BEPUikBlacklistException("Cannot find ConnectionA SimObject named '{0}'", ConnectionASimObjectName); } connectionA = other.getElement(ConnectionABoneName) as BEPUikBone; if (connectionA == null) { throw new BEPUikBlacklistException("Cannot find ConnectionA bone named '{0}' in '{1}'", ConnectionABoneName, ConnectionASimObjectName); } other = instance.getOtherSimObject(ConnectionBSimObjectName); if (other == null) { throw new BEPUikBlacklistException("Cannot find ConnectionB SimObject named '{0}'", ConnectionBSimObjectName); } connectionB = other.getElement(ConnectionBBoneName) as BEPUikBone; if (connectionB == null) { throw new BEPUikBlacklistException("Cannot find ConnectionB bone named '{0}' in '{1}'", ConnectionBBoneName, ConnectionBSimObjectName); } SimElement element = createConstraint(connectionA, connectionB, instance); if (element != null) { instance.addElement(element); } }
internal override void createProduct(SimObjectBase instance, BEPUikScene scene) { var otherObject = instance.getOtherSimObject(this.BoneSimObjectName); if (otherObject != null) { var bone = otherObject.getElement(this.BoneName) as BEPUikBone; if (bone != null) { instance.addElement(new BEPUikDragControl(bone, scene, this, instance)); } else { Log.Default.sendMessage("Cannot add BEPUikDragControl {0} to SimObject {1} because the Sim Object does not contain a bone named {2}.", LogLevel.Warning, BEPUikInterface.PluginName, Name, BoneSimObjectName, BoneName); } } else { Log.Default.sendMessage("Cannot add BEPUikDragControl {0} to SimObject {1} because the Sim Object does not exist.", LogLevel.Warning, BEPUikInterface.PluginName, Name, BoneSimObjectName); } }