Esempio n. 1
0
        public EmptyShape AddEmptyShape()
        {
            IEmptyShapeImp iEmptyShapeImp = _dwi.AddEmptyShape();
            var            retval         = new EmptyShape();

            retval._emtyShapeImp      = iEmptyShapeImp;
            iEmptyShapeImp.UserObject = retval;
            return(retval);
        }
Esempio n. 2
0
        public RigidBody AddRigidBody(float mass, float3 position, float3 orientation, CollisionShape colShape /*, float3 inertia*/)
        {
            /* var meshTrianglesCount = mesh.Triangles.Length;
             * int [] meshTrianglesArray = new int[meshTrianglesCount];
             * for (int c = 0; c < meshTrianglesCount; c++)
             * {
             *   meshTrianglesArray[c] = Convert.ToInt32(mesh.Triangles[c]);
             * }
             *
             * int meshVerteciesCount = mesh.Vertices.Length;
             * float3[] meshVerteciesArray = new float3[meshVerteciesCount];
             * meshVerteciesArray = mesh.Vertices;
             */
            var           shapeType = colShape.GetType().ToString();
            IRigidBodyImp rbi;

            switch (shapeType)
            {
            //Primitives
            case "Fusee.Engine.BoxShape":
                var box = (BoxShape)colShape;
                rbi = _dwi.AddRigidBody(mass, position, orientation, box._boxShapeImp /*, inertia*/);
                break;

            case "Fusee.Engine.CapsuleShape":
                var capsule = (CapsuleShape)colShape;
                rbi = _dwi.AddRigidBody(mass, position, orientation, capsule._capsuleShapeImp /*, inertia*/);
                break;

            case "Fusee.Engine.ConeShape":
                var cone = (ConeShape)colShape;
                rbi = _dwi.AddRigidBody(mass, position, orientation, cone._coneShapeImp /*, inertia*/);
                break;

            case "Fusee.Engine.CylinderShape":
                var cylinder = (CylinderShape)colShape;
                rbi = _dwi.AddRigidBody(mass, position, orientation, cylinder._cylinderShapeImp /*, inertia*/);
                break;

            case "Fusee.Engine.MultiSphereShape":
                var multiSphere = (MultiSphereShape)colShape;
                rbi = _dwi.AddRigidBody(mass, position, orientation, multiSphere._multiSphereShapeImp /*, inertia*/);
                break;

            case "Fusee.Engine.SphereShape":
                var sphere = (SphereShape)colShape;
                rbi = _dwi.AddRigidBody(mass, position, orientation, sphere._sphereShapeImp /*, inertia*/);
                break;

            //Misc
            case "Fusee.Engine.CompoundShape":
                var compShape = (CompoundShape)colShape;
                rbi = _dwi.AddRigidBody(mass, position, orientation, compShape._compoundShapeImp /*, inertia*/);
                break;

            case "Fusee.Engine.EmptyShape":
                var empty = (EmptyShape)colShape;
                rbi = _dwi.AddRigidBody(mass, position, orientation, empty._emtyShapeImp /*, inertia*/);
                break;

            //Meshes
            case "Fusee.Engine.ConvexHullShape":
                var convHullShape = (ConvexHullShape)colShape;
                rbi = _dwi.AddRigidBody(mass, position, orientation, convHullShape._convexHullShapeImp /*, inertia*/);
                break;

            case "Fusee.Engine.GImpactMeshShape":
                var gImpMeshShape = (GImpactMeshShape)colShape;
                rbi = _dwi.AddRigidBody(mass, position, orientation, gImpMeshShape._gImpactMeshShapeImp /*, inertia*/);
                break;

            case "Fusee.Engine.StaticPlaneShape":     //static Shape
                var staticPaneShape = (StaticPlaneShape)colShape;
                rbi = _dwi.AddRigidBody(mass, position, orientation, staticPaneShape._staticPlaneShapeImp /*, inertia*/);
                break;

            //Default
            default:
                var defaultShape = new EmptyShape();
                Debug.WriteLine("default");
                rbi = _dwi.AddRigidBody(mass, position, orientation, defaultShape._emtyShapeImp /*, inertia*/);
                break;
            }

            // IRigidBodyImp rbi = _dwi.AddRigidBody(mass, worldTransform, /* shape, */inertia);

            var retval = new RigidBody();

            //retval.Mesh = mesh;
            retval._iRigidBodyImp = rbi;
            rbi.UserObject        = retval;

            return(retval);
        }
Esempio n. 3
0
 /// <summary>
 /// Adds an empty shape as a child shape.
 /// </summary>
 /// <param name="localTransform">The local transformation of the child shape.</param>
 /// <param name="childShape">The child shape.</param>
 public void AddChildShape(float4x4 localTransform, EmptyShape childShape)
 {
     _compoundShapeImp.AddChildShape(localTransform, childShape._emtyShapeImp);
 }