[ODE] nearcallback pointer help

Christopher Harvey arbuckle911 at gmail.com
Sun Nov 5 15:48:04 MST 2006

I've created a Physics class, here is the .h file.

This class holds all the data for all the objects that have to be synchronized 
on each client.
It also handles the simulation calculations.


#include "Globals.h"

#define MAX_CONTACTS	100		//Really not sure at all what this should be
								//TODO: test to see if we can find out how many it is actually using.
//#include <windows.h>
#include <GL/gl.h>
#include <ode/ode.h>
#include <vector>
#include "timer.h"
using namespace std;

class PhysicsManager

	void SetState(const char *fileName);
	void SaveState(const char *fileName);
	dBodyID AddBox(float *sides, float density, float *position);
	bool RemoveBody(dBodyID id);

	void PhysicsStep(double dt);
	void RenderGeoms();
	void ODEtoOGL(float * M, const float *p, const float *R);
	void DrawBox(const float sides[3], const float R[12]);
	unsigned int getFreeID();
	vector<dBodyID> physicsBodies;

	dWorldID World;
	dSpaceID Space;
	dJointGroupID contactgroup;

//	void nearCallback (void *data, dGeomID o1, dGeomID o2);


Here is my question:
I want to pass the nearcallback function into the dSpaceCollide();
However, I can't cast it into a pointer because it's not a static member. If I 
make it a static member it can't access the World and Space variables, 
because they are not static either. 
I don't mind changing the whole implementation, if there is a known way to 
encapsulate ode in a class. Any ideas?
Thanks in advance. 

More information about the ODE mailing list