internal override void createProduct(Engine.ObjectManagement.SimObjectBase instance, BulletScene scene) { RigidBody rbA = null; RigidBody rbB = null; SimObject other = instance.getOtherSimObject(RigidBodyASimObject); if (other != null) { rbA = other.getElement(RigidBodyAElement) as RigidBody; } other = instance.getOtherSimObject(RigidBodyBSimObject); if (other != null) { rbB = other.getElement(RigidBodyBElement) as RigidBody; } TypedConstraintElement element = createConstraint(rbA, rbB, instance, scene); if (element != null) { instance.addElement(element); } }
protected override void link() { base.link(); SimObject entitySimObject = Owner.getOtherSimObject(anatomySimObjectName); if (entitySimObject == null) { blacklist("Cannot find Anatomy SimObject named '{0}'", anatomySimObjectName); } anatomy = entitySimObject.getElement(anatomyName) as AnatomyIdentifier; if (anatomy == null) { blacklist("Cannot find AnatomyIdentifier '{0}' on Anatomy SimObject '{1}'", anatomyName, anatomySimObjectName); } SimObject poseHandlerSimObject = Owner.getOtherSimObject(poseHandlerSimObjectName); if (poseHandlerSimObject == null) { blacklist("Cannot find PoseHandler SimObject named '{0}'", poseHandlerSimObjectName); } poseHandler = poseHandlerSimObject.getElement(poseHandlerName) as PoseHandler; if (poseHandler == null) { blacklist("Cannot find PoseHandler '{0}' in SimObject '{1}'", poseHandlerName, poseHandlerSimObjectName); } PoseableObjectsManager.add(this); }
protected override void link() { base.link(); SimObject parentSimObject = Owner.getOtherSimObject(parentSimObjectName); if (parentSimObject == null) { blacklist("Cannot find Parent SimObject named '{0}'", parentSimObjectName); } parent = parentSimObject.getElement(parentSimObjectLinkName) as FKElement; if (parent == null) { blacklist("Cannot find FKLink '{0}' on Parent SimObject '{1}'", parentSimObjectLinkName, parentSimObjectName); } if (!String.IsNullOrEmpty(jointSimObjectName)) { SimObject jointSimObject = Owner.getOtherSimObject(jointSimObjectName); if (jointSimObject == null) { blacklist("Cannot find Joint SimObject named '{0}'", jointSimObjectName); } //Find the center of rotation in this object's local space centerOfRotationOffset = jointSimObject.Translation - Owner.Translation; } parent.addChild(this); }
protected override void link() { base.link(); firstAngleSimObject = Owner.getOtherSimObject(firstAngleSimObjectName); if (firstAngleSimObject == null) { blacklist("The first angle SimObject '{0}' could not be found.", firstAngleSimObjectName); } firstAngleBroadcaster = firstAngleSimObject.getElement(firstAngleBroadcasterName) as PositionBroadcaster; if (firstAngleBroadcaster == null) { blacklist("The first angle SimObject '{0}' does not have a position broadcaster named '{1}'.", firstAngleSimObjectName, firstAngleBroadcasterName); } secondAngleSimObject = Owner.getOtherSimObject(secondAngleSimObjectName); if (secondAngleSimObject == null) { blacklist("The second angle SimObject '{0}' could not be found.", secondAngleSimObjectName); } secondAngleBroadcaster = secondAngleSimObject.getElement(secondAngleBroadcasterName) as PositionBroadcaster; if (firstAngleBroadcaster == null) { blacklist("The second angle SimObject '{0}' does not have a position broadcaster named '{1}'.", secondAngleSimObjectName, secondAngleBroadcasterName); } firstAngleBroadcaster.PositionChanged += angleBroadcaster_PositionChanged; secondAngleBroadcaster.PositionChanged += angleBroadcaster_PositionChanged; addToDebugDrawing(); }
public override bool link(SimObject owner, AnatomyIdentifier parentAnatomy, ref String errorMessage) { SimObject targetSimObject = owner.getOtherSimObject(targetSimObjectName); if (targetSimObject == null) { errorMessage = String.Format("Could not find target SimObject {0}", targetSimObjectName); return(false); } transparencyInterface = targetSimObject.getElement(targetTransparencyInterfaceName) as TransparencyInterface; if (transparencyInterface == null) { errorMessage = String.Format("Could not find target TransparencyInterface '{0}' in '{1}'", targetTransparencyInterfaceName, targetSimObject.Name); return(false); } foreach (AnatomyCommand command in parentAnatomy.Commands) { if (command.UIText == TransparencyAnatomyCommand.UI_TEXT) { transparencyAnatomyCommand = (TransparencyAnatomyCommand)command; break; } } if (transparencyAnatomyCommand == null) { errorMessage = String.Format("Can not have a TransparencySectionAnatomyCommand on AnatomyIdentifier {0} because it has no TransparencyAnatomyCommand.", parentAnatomy.AnatomicalName); return(false); } transparencyAnatomyCommand.NumericValueChanged += transparencyAnatomyCommand_NumericValueChanged; transparencyAnatomyCommand.SmoothBlendApplied += transparencyAnatomyCommand_SmoothBlendApplied; return(true); }
protected override void constructed() { DiscController.addDisc(this); SimObject controlPointObj = Owner.getOtherSimObject(controlPointObject); if (controlPointObj != null) { controlPoint = controlPointObj.getElement(controlPointBehavior) as ControlPointBehavior; if (controlPoint == null) { blacklist("Could not find controlPointBehavior {0}.", controlPointBehavior); } } else { blacklist("Could not find controlPointObject {0}.", controlPointObject); } SimObject fossaSimObject = Owner.getOtherSimObject(fossaObject); if (fossaSimObject != null) { fossa = fossaSimObject.getElement(fossaName) as Fossa; if (fossa == null) { blacklist("Could not find Fossa {0} in SimObject {1}.", fossaName, fossaObject); } } else { blacklist("Could not find Fossa SimObject {0}.", fossaObject); } SceneNodeElement node = Owner.getElement(sceneNodeName) as SceneNodeElement; if (node != null) { Entity entity = node.getNodeObject(entityName) as Entity; if (entity != null) { if (entity.hasSkeleton()) { SkeletonInstance skeleton = entity.getSkeleton(); medialPole.findBone(skeleton); lateralPole.findBone(skeleton); ventralPole.findBone(skeleton); posteriorPole.initialize(skeleton, Owner, controlPoint, this); topSurface.initialize(skeleton, fossa, Owner); } } else { blacklist("Could not find entity {0} in node {1}.", entityName, sceneNodeName); } } else { blacklist("Could not find SceneNode {0}.", sceneNodeName); } }
protected override void link() { base.link(); if (poseHandlerMappings.Count == 0) { blacklist("No pose handler mappings specified."); } foreach (var mapping in poseHandlerMappings) { SimObject mappedSimObject = Owner.getOtherSimObject(mapping.SimObjectName); if (mappedSimObject == null) { blacklist("Cannot find mapped SimObject '{0}' The scene will be unstable, since this error is not handled in any way.", mapping.SimObjectName); } var poseHandler = mappedSimObject.getElement(mapping.PoseHandlerName) as PoseHandler; if (poseHandler == null) { blacklist("Cannot find PoseHandler '{0}' on SimObject '{1}' The scene will be unstable, since this error is not handled in any way.", mapping.PoseHandlerName, mapping.SimObjectName); } poseHandler.addPoseCommandAction(this, mapping.Mode); } }
protected override void constructed() { SimObject targetObject = Owner.getOtherSimObject(targetSimObject); if (targetObject == null) { blacklist("Could not find Target SimObject {0}.", targetSimObject); } SceneNodeElement node = targetObject.getElement(targetNode) as SceneNodeElement; if (node == null) { blacklist("Could not find target SceneNodeElement {0}.", targetNode); } Entity entity = node.getNodeObject(targetEntity) as Entity; if (entity == null) { blacklist("Could not find Entity {0}.", targetEntity); } mesh = entity.getMesh(); OgrePlugin.Animation anim; VertexAnimationTrack track; if (mesh.Value.hasAnimation(manualAnimationName)) { anim = mesh.Value.getAnimation(manualAnimationName); track = anim.getVertexTrack(1); manualKeyFrame = track.getKeyFrame(0) as VertexPoseKeyFrame; } else { blacklist("Could not find animation {0}.", manualAnimationName); } //Must look this up this way to get the correct pose index. int poseCount = mesh.Value.getPoseCount(); OgrePlugin.Pose pose = null; for (ushort i = 0; i < poseCount; ++i) { OgrePlugin.Pose innerPose = mesh.Value.getPose(i); if (innerPose.getName() == poseName) { pose = innerPose; poseIndex = i; break; } } if (pose == null) { blacklist("Cannot find pose {0}.", poseName); } manualKeyFrame.addPoseReference(poseIndex, 0.0f); manualAnimationState = entity.getAnimationState(manualAnimationName); manualAnimationState.setLength(0.0f); manualAnimationState.setTimePosition(0.0f); manualAnimationState.setEnabled(true); AnimationManipulatorController.addAnimationManipulator(this); }
protected override void constructed() { joint = Owner.getElement(jointName) as Generic6DofConstraintElement; if (joint == null) { blacklist("Could not find Joint {0}.", jointName); } originalPosition = joint.getFrameOffsetOriginA(); rigidBody = Owner.getElement(rigidBodyName) as RigidBody; if (rigidBody == null) { blacklist("Could not find RigidBody {0}", rigidBodyName); } rigidBody.ContactStarted += new CollisionCallback(rigidBody_ContactStarted); rigidBody.ContactEnded += new CollisionCallback(rigidBody_ContactEnded); skinObject = Owner.getOtherSimObject(skinSimObjectName); if (skinObject == null) { blacklist("Could not find Target skin SimObject {0}.", skinSimObjectName); } SceneNodeElement node = skinObject.getElement(skinNodeName) as SceneNodeElement; if (node == null) { blacklist("Could not find target skin SceneNodeElement {0}.", skinSimObjectName); } Entity entity = node.getNodeObject(skinEntityName) as Entity; if (entity == null) { blacklist("Could not find skin Entity {0}.", skinNodeName); } if (!entity.hasSkeleton()) { blacklist("Skin Entity {0} does not have a skeleton.", skinEntityName); } SkeletonInstance skeleton = entity.getSkeleton(); if (skeleton.hasBone(lipBoneName)) { lipBone = skeleton.getBone(lipBoneName); lipBone.setManuallyControlled(true); offset = lipBone.getPosition() + skinObject.Translation - this.Owner.Translation; lastPosition = this.Owner.Translation; } else { blacklist("Cannot find bone {0} in Skin Entity {1} in SimObject {2}", lipBoneName, skinEntityName, skinSimObjectName); } }
public override bool link(SimObject owner, AnatomyIdentifier parentAnatomy, ref String errorMessage) { transparencyInterface = owner.getElement(transparencyInterfaceName) as TransparencyInterface; if (transparencyInterface == null) { errorMessage = String.Format("Could not find TransparencyInterface named {0}", transparencyInterfaceName); return(false); } parentAnatomy._setTransparencyCommand(this); return(true); }
protected override void constructed() { targetObject = Owner.getOtherSimObject(targetSimObject); if (targetObject != null) { SceneNodeElement node = targetObject.getElement(targetNode) as SceneNodeElement; if (node != null) { Entity entity = node.getNodeObject(targetEntity) as Entity; if (entity != null) { if (entity.hasSkeleton()) { skeleton = entity.getSkeleton(); if (skeleton.hasBone(targetBone)) { bone = skeleton.getBone(targetBone); offset = Owner.Translation - targetObject.Translation - bone.getDerivedPosition(); //calculate the scale at 100% Vector3 adjust = (Vector3.ScaleIdentity - Owner.Scale) * offset; offset += adjust; } else { blacklist("Entity {0} does not have a bone named {1}.", targetEntity, targetBone); } } else { blacklist("Entity {0} does not have a skeleton.", targetEntity); } } else { blacklist("Could not find Entity {0}.", targetEntity); } } else { blacklist("Could not find target SceneNodeElement {0}.", targetNode); } } else { blacklist("Could not find Target SimObject {0}.", targetSimObject); } joint = Owner.getElement(jointName) as Generic6DofConstraintElement; if (joint == null) { blacklist("Could not find joint {0}.", jointName); } }
protected override void constructed() { tongueObject = Owner.getOtherSimObject(tongueSimObjectName); if (tongueObject == null) { blacklist("Could not find Target tongue SimObject {0}.", tongueSimObjectName); } SceneNodeElement node = tongueObject.getElement(tongueNodeName) as SceneNodeElement; if (node == null) { blacklist("Could not find target tongue SceneNodeElement {0}.", tongueSimObjectName); } Entity entity = node.getNodeObject(tongueEntityName) as Entity; if (entity == null) { blacklist("Could not find tongue Entity {0}.", tongueNodeName); } if (!entity.hasSkeleton()) { blacklist("Tongue Entity {0} does not have a skeleton.", tongueEntityName); } SkeletonInstance skeleton = entity.getSkeleton(); bone = skeleton.getBone(boneName); if (bone == null) { blacklist("Tongue Entity {0} does not have a bone named {1}.", tongueEntityName, boneName); } offset = Owner.Translation - tongueObject.Translation - bone.getDerivedPosition(); //calculate the scale at 100% Vector3 adjust = (Vector3.ScaleIdentity - Owner.Scale) * offset; offset += adjust; joint = Owner.getElement(jointName) as Generic6DofConstraintElement; if (joint == null) { blacklist("Could not find Joint {0}.", jointName); } rigidBody = Owner.getElement(rigidBodyName) as RigidBody; if (rigidBody == null) { blacklist("Could not find RigidBody {0}", rigidBodyName); } }
protected override void constructed() { targetObject = Owner.getOtherSimObject(targetSimObject); if (targetObject != null) { SceneNodeElement node = targetObject.getElement(targetNode) as SceneNodeElement; if (node != null) { Entity entity = node.getNodeObject(targetEntity) as Entity; if (entity != null) { if (entity.hasSkeleton()) { skeleton = entity.getSkeleton(); if (skeleton.hasBone(targetBone)) { bone = skeleton.getBone(targetBone); //Calculate the offset from this object to the bone offset = Owner.Translation - (targetObject.Translation + bone.getDerivedPosition()); //calculate the scale at 100% Vector3 adjust = (Vector3.ScaleIdentity - Owner.Scale) * offset; offset += adjust; //Rotate the offset into the space for the object offset = Quaternion.quatRotate(targetObject.Rotation.inverse(), offset); } else { blacklist("Entity {0} does not have a bone named {1}.", targetEntity, targetBone); } } else { blacklist("Entity {0} does not have a skeleton.", targetEntity); } } else { blacklist("Could not find Entity {0}.", targetEntity); } } else { blacklist("Could not find target SceneNodeElement {0}.", targetNode); } } else { blacklist("Could not find Target SimObject {0}.", targetSimObject); } }
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); } }
protected override void link() { base.link(); SimObject targetSimObject = Owner.getOtherSimObject(targetSimObjectName); if (targetSimObject == null) { blacklist("The target SimObject {0} could not be found.", targetSimObjectName); } follower = targetSimObject.getElement(targetFollowerName) as SimObjectFollowerWithRotation; if (follower == null) { blacklist("The target SimObject {0} does not have a SimObjectFollowerWithRotation named {1}.", targetSimObjectName, targetFollowerName); } SimObject blendDriverSimObject = Owner.getOtherSimObject(blendDriverSimObjectName); if (blendDriverSimObject == null) { blacklist("The blend driver SimObject {0} could not be found.", blendDriverSimObjectName); } blendDriver = targetSimObject.getElement(blendDriverElementName) as BlendDriver; if (blendDriver == null) { blacklist("The blend driver SimObject {0} does not have a BlendDriver named {1}.", blendDriverSimObjectName, blendDriverElementName); } loadSequence(sequenceFileName); if (editable) { editablePlayers.Add(this); } }
protected override void link() { SimObject cullSimObject = Owner.getOtherSimObject(cullSimObjectName); if (cullSimObject == null) { blacklist("Could not find cull SimObject {0}.", cullSimObjectName); } cullInterface = cullSimObject.getElement(cullTransparencyInterfaceName) as TransparencyInterface; if (cullInterface == null) { blacklist("Could not find cull transparency interface {0} in SimObject {1}.", cullTransparencyInterfaceName, cullSimObject); } cullInterface.setTransparencyOverrider(this); }
protected override void destroy() { foreach (var mapping in poseHandlerMappings) { SimObject mappedSimObject = Owner.getOtherSimObject(mapping.SimObjectName); if (mappedSimObject != null) { var poseHandler = mappedSimObject.getElement(mapping.PoseHandlerName) as PoseHandler; if (poseHandler != null) { poseHandler.removePoseCommandAction(this, mapping.Mode); } } } base.destroy(); }
protected override void constructed() { SimObject tongueObject = Owner.getOtherSimObject(tongueSimObjectName); if (tongueObject == null) { blacklist("Could not find Target tongue SimObject {0}.", tongueSimObjectName); } SceneNodeElement node = tongueObject.getElement(tongueNodeName) as SceneNodeElement; if (node == null) { blacklist("Could not find target tongue SceneNodeElement {0}.", tongueSimObjectName); } Entity entity = node.getNodeObject(tongueEntityName) as Entity; if (entity == null) { blacklist("Could not find tongue Entity {0}.", tongueNodeName); } protrude = entity.getAnimationState(protrudeAnimationName); if (protrude == null) { blacklist("Tongue Entity {0} does not have an animation for protrusion named {1}.", tongueEntityName, protrudeAnimationName); } back = entity.getAnimationState(backAnimationName); if (back == null) { blacklist("Tongue Entity {0} does not have an animation for back named {1}.", tongueEntityName, backAnimationName); } rest = entity.getAnimationState(restAnimationName); if (rest == null) { blacklist("Tongue Entity {0} does not have an animation for rest named {1}.", tongueEntityName, restAnimationName); } protrude.setLoop(false); back.setLoop(false); rest.setLoop(false); TongueMode = tongueMode; }
protected override void constructed() { SimObject targetObject = Owner.getOtherSimObject(targetSimObject); if (targetObject != null) { SceneNodeElement node = targetObject.getElement(targetNode) as SceneNodeElement; if (node != null) { Entity entity = node.getNodeObject(targetEntity) as Entity; if (entity != null) { if (entity.hasSkeleton()) { skeleton = entity.getSkeleton(); if (skeleton.hasBone(targetBone)) { bone = skeleton.getBone(targetBone); bone.setManuallyControlled(true); AnimationManipulatorController.addAnimationManipulator(this); } else { blacklist("Entity {0} does not have a bone named {1}.", targetEntity, targetBone); } } else { blacklist("Entity {0} does not have a skeleton.", targetEntity); } } else { blacklist("Could not find Entity {0}.", targetEntity); } } else { blacklist("Could not find target SceneNodeElement {0}.", targetNode); } } else { blacklist("Could not find Target SimObject {0}.", targetSimObject); } }
protected override void link() { base.link(); SimObject boneSimObject = Owner.getOtherSimObject(boneSimObjectName); if (boneSimObject == null) { blacklist("Cannot find Bone SimObject named '{0}'", boneSimObjectName); } bone = boneSimObject.getElement(boneName) as BEPUikBone; if (bone == null) { blacklist("Cannot find BEPUikBone '{0}' in Bone SimObject '{1}'", boneName, boneSimObjectName); } }
protected override void link() { base.link(); //Parent segment parentSegmentSimObject = Owner.getOtherSimObject(parentSegmentSimObjectName); if (parentSegmentSimObject == null) { blacklist("Cannot find parent segment SimObject '{0}'.", parentSegmentSimObjectName); } var parentSegment = parentSegmentSimObject.getElement(parentSegmentName) as ProxyChainSegment; if (parentSegment == null) { blacklist("Cannot find segment '{0}' on parent segment SimObject '{1}'.", parentSegmentName, parentSegmentSimObjectName); } parentSegment.setChildSegment(this); }
protected override void constructed() { targetObject = Owner.getOtherSimObject(targetSimObject); if (targetObject != null) { nodeElement = targetObject.getElement(targetNode) as SceneNodeElement; if (nodeElement != null) { offset = this.Owner.Translation - nodeElement.getDerivedPosition(); } else { blacklist("Could not find target SceneNodeElement {0}.", targetNode); } } else { blacklist("Could not find Target SimObject {0}.", targetSimObject); } }
protected override void link() { base.link(); SimObject rigidBodySimObject = Owner.getOtherSimObject(rigidBodySimObjectName); if (rigidBodySimObject == null) { blacklist("Cannot find rigidBodySimObject '{0}'", rigidBodySimObjectName); } RigidBody rigidBody = rigidBodySimObject.getElement(rigidBodyName) as RigidBody; if (rigidBody == null) { blacklist("Cannot find rigid body '{0}' rigidBodySimObject '{1}'", rigidBodyName, rigidBodySimObjectName); } bulletScene = rigidBody.Scene; bulletScene.AutoSynchronizeAfterUpdate = false; }
protected override void link() { SimObject controlSimObject = Owner.getOtherSimObject(controlSimObjectName); if (controlSimObject == null) { blacklist("Cannot find Control SimObject named '{0}'", controlSimObjectName); } control = controlSimObject.getElement(dragControlName) as BEPUikDragControl; if (control == null) { blacklist("Cannot find BEPUikDragControl '{0}' in Control SimObject '{1}'", dragControlName, controlSimObjectName); } var boneOwner = control.Bone.Owner; controlBoneOffset = Quaternion.quatRotate(boneOwner.Rotation.inverse(), control.Owner.Translation - boneOwner.Translation); base.link(); }
protected override void link() { targetSimObject = Owner.getOtherSimObject(targetSimObjectName); if (targetSimObject == null) { blacklist("Cannot find target SimObject {0}.", targetSimObjectName); } broadcaster = targetSimObject.getElement(targetPositionBroadcasterName) as PositionBroadcaster; if (broadcaster == null) { blacklist("Cannot find target PositionBroadcaster '{0}' on SimObject '{1}'", targetPositionBroadcasterName, targetSimObjectName); } broadcaster.PositionChanged += broadcaster_PositionChanged; Quaternion inverseTargetRot = targetSimObject.Rotation.inverse(); translationOffset = Owner.Translation - targetSimObject.Translation; translationOffset = Quaternion.quatRotate(inverseTargetRot, translationOffset); rotationOffset = inverseTargetRot * Owner.Rotation; }
public void link(MultiSimObjectFollowerWithRotation follower) { this.follower = follower; targetSimObject = follower.Owner.getOtherSimObject(targetSimObjectName); if (targetSimObject == null) { throw new Exception(String.Format("Cannot find target SimObject {0}.", targetSimObjectName)); } broadcaster = targetSimObject.getElement(targetPositionBroadcasterName) as PositionBroadcaster; if (broadcaster == null) { throw new Exception(String.Format("Cannot find target PositionBroadcaster '{0}' on SimObject '{1}'", targetPositionBroadcasterName, targetSimObjectName)); } broadcaster.PositionChanged += broadcaster_PositionChanged; Quaternion inverseTargetRot = targetSimObject.Rotation.inverse(); translationOffset = follower.Owner.Translation - targetSimObject.Translation; translationOffset = Quaternion.quatRotate(inverseTargetRot, translationOffset); rotationOffset = inverseTargetRot * follower.Owner.Rotation; }
protected override void constructed() { curve = new CatmullRomSpline3d(); FossaController.add(this); SimObject eminanceSimObject = Owner.getOtherSimObject(eminanceName); if (eminanceSimObject == null) { blacklist("Cannot find the eminance SimObject {0}", eminanceName); } eminanceOffset = eminanceSimObject.Translation; SceneNodeElement eminanceSceneNode = eminanceSimObject.getElement(eminanceNodeName) as SceneNodeElement; if (eminanceSceneNode == null) { blacklist("Cannot find the eminance scene node {0}", eminanceNodeName); } Entity eminanceEntity = eminanceSceneNode.getNodeObject(eminanceEntityName) as Entity; if (eminanceEntity == null) { blacklist("Cannot find the eminance entity {0}", eminanceEntityName); } if (!eminanceEntity.hasSkeleton()) { blacklist("Eminance entity {0} does not have a skeleton.", eminanceEntityName); } SkeletonInstance skeleton = eminanceEntity.getSkeleton(); for (int i = 1; skeleton.hasBone(fossaBoneBaseName + i); ++i) { Bone bone = skeleton.getBone(fossaBoneBaseName + i); eminanceBones.Add(bone); bone.setManuallyControlled(true); } SimObject skullSimObject = Owner.getOtherSimObject(skullName); if (skullSimObject == null) { blacklist("Could not find a skull SimObject named {0}.", skullName); } skullOffset = skullSimObject.Translation; SceneNodeElement skullNode = skullSimObject.getElement(skullNodeName) as SceneNodeElement; if (skullNode == null) { blacklist("Could not find skull node {0}.", skullNodeName); } Entity skullEntity = skullNode.getNodeObject(skullEntityName) as Entity; if (skullEntity == null) { blacklist("Could not find skull entity {0}.", skullEntityName); } if (!skullEntity.hasSkeleton()) { blacklist("Skull entity {0} does not have a skeleton.", skullEntityName); } skeleton = skullEntity.getSkeleton(); Vector3 eminanceTrans = Vector3.Zero; for (int i = 1; skeleton.hasBone(fossaBoneBaseName + i); ++i) { Bone bone = skeleton.getBone(fossaBoneBaseName + i); skullBones.Add(bone); bone.setManuallyControlled(true); Vector3 trans = bone.getDerivedPosition() + skullSimObject.Translation - this.Owner.Translation; trans.x = 0; basePoints.Add(trans); if (i < eminanceStart) { eminanceDistort.Add(trans); eminanceTrans = trans; } else { trans.y = eminanceTrans.y; eminanceDistort.Add(trans); } } foreach (Vector3 point in basePoints) { curve.addControlPoint(point); } //Find the control point SimObject controlPointObj = Owner.getOtherSimObject(controlPointObject); if (controlPointObj == null) { blacklist("Could not find controlPointObject {0}.", controlPointObject); } controlPoint = controlPointObj.getElement(controlPointBehavior) as ControlPointBehavior; if (controlPoint == null) { blacklist("Could not find controlPointBehavior {0}.", controlPointBehavior); } }
protected override void constructed() { boneObject = Owner.getOtherSimObject(boneSimObject); if (boneObject != null) { SceneNodeElement node = boneObject.getElement(boneNode) as SceneNodeElement; if (node != null) { Entity entity = node.getNodeObject(boneEntity) as Entity; if (entity != null) { if (entity.hasSkeleton()) { SkeletonInstance skeleton = entity.getSkeleton(); if (skeleton.hasBone(targetBone)) { bone = skeleton.getBone(targetBone); } else { blacklist("Entity {0} does not have a bone named {1}.", boneEntity, targetBone); } } else { blacklist("Entity {0} does not have a skeleton.", boneEntity); } } else { blacklist("Could not find Entity {0}.", boneEntity); } } else { blacklist("Could not find target SceneNodeElement {0}.", boneNode); } } else { blacklist("Could not find Target SimObject {0}.", boneSimObject); } SimObject discSimObject = Owner.getOtherSimObject(discObject); if (discSimObject != null) { disc = discSimObject.getElement(discName) as Disc; if (disc == null) { blacklist("Could not find Disc {0} in SimObject {1}.", discName, discObject); } } else { blacklist("Could not find Disc SimObject {0}.", discObject); } joint = Owner.getElement(jointName) as Generic6DofConstraintElement; if (joint == null) { blacklist("Could not find joint {0}.", jointName); } ControlPointController.addControlPoint(this); }