internal Behavior createStaticProduct(SimObjectBase instance, BehaviorManager scene) { var staticBehavior = behaviorTemplate.createStaticStandIn(); if (staticBehavior != null) { staticBehavior.setAttributes(Name, scene); instance.addElement(staticBehavior); } return(staticBehavior); }
internal override void createProduct(SimObjectBase instance, BEPUikScene scene) { BEPUikBone bone; if (LocalRotQuat.HasValue) { bone = new BEPUikBoneLocalRot(this, instance, scene); } else { bone = new BEPUikBone(this, instance, scene); } instance.addElement(bone); }
internal Behavior createProduct(SimObjectBase instance, BehaviorManager behaviorManager, bool copyBehavior) { Behavior behavior; if (copyBehavior) { behavior = MemberCopier.CreateCopy <Behavior>(behaviorTemplate); } else { behavior = behaviorTemplate; } behavior.setAttributes(Name, behaviorManager); instance.addElement(behavior); return(behavior); }
/// <summary> /// Create the product of this SceneNode. /// </summary> /// <param name="instance">The instance to get the product.</param> /// <param name="scene">The scene to create the product into.</param> internal void createProduct(SimObjectBase instance, OgreSceneManager scene) { SceneNode node = scene.SceneManager.createSceneNode(instance.Name + Name); node.setPosition(instance.Translation); node.setOrientation(instance.Rotation); SceneNodeElement element = new SceneNodeElement(Name, scene, node, scene.SceneManager.getRootSceneNode()); instance.addElement(element); foreach (MovableObjectDefinition movable in movableObjects.Values) { element.attachObject(movable); } foreach (SceneNodeDefinition child in childNodes.Values) { child.createAsChild(instance, scene, element); } }
internal override void createProduct(SimObjectBase instance, BulletScene scene) { BulletShapeRepository repository = BulletInterface.Instance.ShapeRepository; if (repository.containsValidCollection(ShapeName)) { btCollisionShape shape = repository.getCollection(ShapeName).CollisionShape; if (constructionInfo.m_mass != 0.0f) { shape.calculateLocalInertia(constructionInfo.m_mass, ref constructionInfo.m_localInertia); } RigidBody rigidBody = new RigidBody(this, scene, shape, instance.Translation, instance.Rotation); instance.addElement(rigidBody); } else { Log.Default.sendMessage("Could not find collision shape named {0}.", LogLevel.Warning, "BulletPlugin", ShapeName); } }
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); } }
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); } }