Пример #1
0
 public void addHeightField(Space space, double[] field, float width, float depth, int widthsamples, int depthsamples)
 {
     IntPtr dataID = Ode.dGeomHeightfieldDataCreate();
     Ode.dGeomHeightfieldDataBuildDouble(dataID, field, 1, width, depth, widthsamples, depthsamples, 1.0f, 0.0f, 1.0f, 0);
     IntPtr heightfield = Ode.dCreateHeightfield(space.getSpaceID(), dataID, 1);
     Ode.dGeomSetPosition(heightfield, width/2.0f, 0.0f, depth/2.0f);
 }
Пример #2
0
        public BodyBox(World hostWorld, Space space, Vector3f position, Vector3f size, Vector3f force)
        {
            this.hostWorld = hostWorld;
            this.space = space;

            bodyID = Ode.dBodyCreate(hostWorld.getID());

            // create a mass object, in this case a box of size 50 x 0.2 x 50
            Ode.dMass mass = new Ode.dMass();
            //Ode.dMassSetBox(ref mass, 200.0f, radius, radius, radius);
            Ode.dMassSetBoxTotal(ref mass, 200.0f, size.x, size.y, size.z);
            // set it's mass to 1000.0f. If this value is too low,
            // you'll get some wierd collisions
            //mass.mass = 1000.0f;

            // set the mass object on the body
            Ode.dBodySetMass(bodyID, ref mass);

            // Set the body's position
            Ode.dBodySetPosition(bodyID, position.x, position.y, position.z);

            // Set an initial force on the body. This will be
            // wiped to zero after the first frame.
            Ode.dBodyAddForce( bodyID, force.x, force.y, force.z );

            // create a collion geometry to go with our rigid body.
            // without this, the rigid body will not collide with anything.
            geomID = Ode.dCreateBox(space.getSpaceID(), size.x, size.y, size.z);

            // assign a rigid body to the collision geometry. If we didn't do this,
            // the object would be a static object much like our ground plane.
            Ode.dGeomSetBody(geomID, bodyID);

            this.position = position.copy();
            this.rotationOGL = new Color4f(0.0f, 0.0f, 0.0f, 0.0f);
        }
Пример #3
0
 public BodySphere createShphere(Space space, Vector3f position, float radius, Vector3f force)
 {
     BodySphere b = new BodySphere(this, space, position, radius, force);
     listBodiesSpheres.Add(b);
     return b;
 }
Пример #4
0
 public void createPlane(Space space, float y)
 {
     IntPtr ground = Ode.dCreatePlane(space.getSpaceID(), 0.01f,1.0f,0.0f, 10.0f);
     //Ode.dGeomSetPosition(ground, 0.0f, y, 0.0f);
 }
Пример #5
0
 public BodyBox createBox(Space space, Vector3f position, Vector3f size, Vector3f force)
 {
     BodyBox b = new BodyBox(this, space, position, size, force);
     listBodiesBoxes.Add(b);
     return b;
 }
Пример #6
0
 public Space addSpace()
 {
     Space space = new Space( this, this.contactGroup );
     listSpaces.Add(space);
     return space;
 }