Exemplo n.º 1
0
 public BEPUikBoneLocalRot(BEPUikBoneDefinition definition, SimObjectBase instance, BEPUikScene scene)
     : base(definition, instance, scene)
 {
     localRot            = definition.LocalRotQuat.Value;
     localRotInverse     = localRot.inverse();
     IkBone.Orientation *= localRot.toBepuQuat();
 }
Exemplo n.º 2
0
        internal override void createProduct(SimObjectBase instance, BulletScene scene)
        {
            btCompoundShape      shape     = new btCompoundShape(0.0f);
            ReshapeableRigidBody rigidBody = new ReshapeableRigidBody(this, scene, shape, instance.Translation, instance.Rotation);

            instance.addElement(rigidBody);
        }
Exemplo n.º 3
0
        public SimObjectBase createProp(String propName, Vector3 translation, Quaternion rotation)
        {
            if (subScene != null)
            {
                PropDefinition propDef;
                if (prototypes.TryGetValue(propName, out propDef))
                {
                    SimObjectDefinition definition          = propDef.SimObject;
                    Vector3             originalTranslation = definition.Translation;
                    Quaternion          originalRotation    = definition.Rotation;

                    definition.Name        = UniqueKeyGenerator.generateStringKey();
                    definition.Translation = translation;
                    definition.Rotation    = rotation;
                    SimObjectBase instance = definition.register(subScene);
                    medicalController.addSimObject(instance);
                    scene.buildScene();

                    definition.Translation = originalTranslation;
                    definition.Rotation    = originalRotation;
                    return(instance);
                }
                else
                {
                    Log.Error("Could not create prop {0}. The definition cannot be found.", propName);
                }
            }
            else
            {
                Log.Error("Could not create prop {0}. The subscene is null.", propName);
            }
            return(null);
        }
Exemplo n.º 4
0
 public BEPUikBone(BEPUikBoneDefinition definition, SimObjectBase instance, BEPUikScene scene)
     : base(definition.Name)
 {
     this.scene  = scene;
     bone        = new Bone(instance.Translation.toBepuVec3(), instance.Rotation.toBepuQuat(), definition.Radius, definition.Height, definition.Mass);
     bone.Pinned = definition.Pinned;
     solverName  = definition.SolverName;
 }
Exemplo n.º 5
0
 public void editRotation(ref Quaternion rotation)
 {
     if (simObjectController != null)
     {
         SimObjectBase simObj = simObjectController.getSimObject(Name) as SimObjectBase;
         if (simObj != null)
         {
             simObj.updateRotation(ref rotation, null);
         }
     }
     instance.Definition.Rotation = rotation;
     Modified = true;
 }
Exemplo n.º 6
0
 public void editTranslation(ref Vector3 translation)
 {
     if (simObjectController != null)
     {
         SimObjectBase simObj = simObjectController.getSimObject(Name) as SimObjectBase;
         if (simObj != null)
         {
             simObj.updateTranslation(ref translation, null);
         }
     }
     instance.Translation = translation;
     Modified             = true;
 }
        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);
            }
        }