[ODE] What NearCallback must be like? I cannot place it inside a class!
michael kapelko
kornerr at gmail.com
Thu Jul 27 03:28:58 MST 2006
Now it says:
main.cpp:236: error: invalid conversion from `void (*)(PhysicsBasic*,
dxGeom*,
dxGeom*)' to `void (*)(void*, dxGeom*, dxGeom*)'
I tried to set it static, keep void*, set world, space as static. Object
files were compiled ok.
But compiler cannot link them. Looks like it can't see my static world,
space anymore:
physics/.obj/basic.o(.text+0x1ad): In function
`PhysicsBasic::NearCallback(void*, dxGeom*, dxGeom*)':
: undefined reference to `PhysicsBasic::contact_group'
physics/.obj/basic.o(.text+0x1b3): In function
`PhysicsBasic::NearCallback(void*, dxGeom*, dxGeom*)':
: undefined reference to `PhysicsBasic::world'
physics/.obj/basic.o(.text+0x244): In function
`PhysicsBasic::CreateWorld()':
: undefined reference to `PhysicsBasic::world'
physics/.obj/basic.o(.text+0x256): In function
`PhysicsBasic::CreateWorld()':
: undefined reference to `PhysicsBasic::space'
physics/.obj/basic.o(.text+0x268): In function
`PhysicsBasic::CreateWorld()':
: undefined reference to `PhysicsBasic::contact_group'
physics/.obj/basic.o(.text+0x280): In function
`PhysicsBasic::CreateWorld()':
: undefined reference to `PhysicsBasic::world'
physics/.obj/basic.o(.text+0x299): In function
`PhysicsBasic::DestroyWorld()':
: undefined reference to `PhysicsBasic::contact_group'
physics/.obj/basic.o(.text+0x2aa): In function
`PhysicsBasic::DestroyWorld()':
: undefined reference to `PhysicsBasic::space'
physics/.obj/basic.o(.text+0x2bb): In function
`PhysicsBasic::DestroyWorld()':
: undefined reference to `PhysicsBasic::world'
.obj/main.o(.text+0x148): In function `Simulate(bool)':
: undefined reference to `PhysicsBasic::space'
.obj/main.o(.text+0x15b): In function `Simulate(bool)':
: undefined reference to `PhysicsBasic::world'
.obj/main.o(.text+0x172): In function `Simulate(bool)':
: undefined reference to `PhysicsBasic::world'
.obj/main.o(.text+0x183): In function `Simulate(bool)':
: undefined reference to `PhysicsBasic::contact_group'
.obj/main.o(.text+0x462): In function `main':
: undefined reference to `PhysicsBasic::space'
collect2: ld returned 1 exit status
make: *** [test] Error 1
callback function:
void PhysicsBasic::NearCallback (void *data, dGeomID o1, dGeomID o2) {
dBodyID b1 = dGeomGetBody (o1);
dBodyID b2 = dGeomGetBody (o2);
// If bodies are connected with a joint, then no collision
detection needed
if (b1 && b2 && dAreConnected (b1, b2))
return;
// Maximum possible contacts
const int N = 4;
dContact contact[N];
// How much contacts do we actually have?
int n = dCollide (o1, o2, N, &contact[0].geom, sizeof (dContact));
if (n > 0)
for (int i = 0; i < n; i++) {
// What these parameters mean, you can read in ODE Manual
contact[i].surface.mode = dContactSlip1 | dContactSlip2 |
dContactSoftERP | dContactSoftCFM | dContactApprox1;
contact[i].surface.mu = dInfinity;
contact[i].surface.slip1 = 0.1;
contact[i].surface.slip2 = 0.1;
contact[i].surface.soft_erp = 0.2;
contact[i].surface.soft_cfm = 0.2;
dJointID c = dJointCreateContact (world, contact_group,
&contact[i]);
dJointAttach (c, dGeomGetBody (contact[i].geom.g1),
dGeomGetBody (contact[i].geom.g2));
}
}
More information about the ODE
mailing list