[ODE] geom transform; does not work?

UnixBird unixbird at yahoo.se
Sun Jul 18 13:49:14 MST 2004


Given the code below, I try to create a body with two collision cylinders
at the bottom of the body. The code does not work. What am I doing wrong?

// at start
Init()
{
// create a world
GlobalWorld = dWorldCreate();
WorldSpace = dHashSpaceCreate( 0 );
GlobalContactGroup = dJointGroupCreate( 0 );
dWorldSetGravity( GlobalWorld, 0.0, -9.81, 0.0 );
// create ground plane
GroundGeom = dCreatePlane( WorldSpace, 0.0, 1.0, 0.0, 0.0 );

// create fuselage body
Airframe.OdeBody = dBodyCreate( GlobalWorld );
// set position
dBodySetPosition( Airframe.OdeBody, 0.0, 1.7, 0.0 );

// set mass
dMassSetZero( &BodyMass );
dMassSetBoxTotal( &BodyMass, 4000.0, 1.0, 1.5, 3.1 );
dBodySetMass( Airframe.OdeBody, &BodyMass );

// create a collision geom for bottom left
AirframeGeomBottomL.GeomTransform = dCreateGeomTransform( 0 );
AirframeGeomBottomL.BaseGeom = dCreateCCylinder( 0, 0.38, 3.5 );
dGeomTransformSetGeom( AirframeGeomBottomL.GeomTransform,
dGeomSetPosition( AirframeGeomBottomL.BaseGeom, -0.400, -0.634, 1.19 );
AirframeGeomBottomL.BaseGeom );
dGeomSetBody( AirframeGeomBottomL.GeomTransform, Airframe.OdeBody );

// create a collision geom for bottom right
AirframeGeomBottomR.GeomTransform = dCreateGeomTransform( 0 );
AirframeGeomBottomR.BaseGeom = dCreateCCylinder( 0, 0.38, 3.5 );
dGeomTransformSetGeom( AirframeGeomBottomR.GeomTransform,
dGeomSetPosition( AirframeGeomBottomR.BaseGeom,  0.400, -0.634, 1.19 );
AirframeGeomBottomR.BaseGeom );
dGeomSetBody( AirframeGeomBottomR.GeomTransform, Airframe.OdeBody );

// add geoms to space
AircraftBodySpace = dSimpleSpaceCreate( WorldSpace );
dSpaceSetCleanup( AircraftBodySpace, 1 );
dSpaceAdd( AircraftBodySpace, AirframeGeomBottomL.GeomTransform );
dSpaceAdd( AircraftBodySpace, AirframeGeomBottomR.GeomTransform );
}

// looped
void DoFrame( SCALAR fDeltaTime )
{
dSpaceCollide( WorldSpace, 0, &ResolveCollisions );
dWorldStep( GlobalWorld, fDeltaTime );
dJointGroupEmpty( GlobalContactGroup );
}

Please help, thank you.
Pawel


Höstrusk och grå moln - köp en resa till solen på Yahoo! Resor på adressen http://se.docs.yahoo.com/travel/index.html


More information about the ODE mailing list