Problem making an ofEasyCam() to follow a 3d Rigid body which has been drawn using open dynamic engine?

I have been struggling to work out how I am supposed to make my ‘cam’ (ofEasyCam object) to follow a rigid 3d body drawn using ODE. Does anyone have any ideas on how I would approach this?


ofEasyCam is a particular type of camera that it is attached to your mouse interaction. I would suggest you to use ofCamera instead, and to have a look at examples/3d/cameraParentingExamples. In openFrameworks, both ofCamera and of3DPrimitive are inherit from an ofNode. ofNode is a class that allows you to define hierarchies between obejcts (again, in the examples folder, look at examples/3d/ofNodeExample), and has some handy methods like lookAt.

If you make your object inherits from ofNode, or even better, you define as member property an ofNode, you can attach children objects to it. In your case, you could attach a camera to it, so that when you move the object, the camera move with it. Your object class could be smth like this:

class myObj{
    void draw(){
    void setParent(ofNode parentNode){
   // expose in the public API of your object just the methods from ofNode that you need
void loadModel(ODEwhatevertype oveMesh){}; //implement a method that loads your ODE mesh in your mesh  `ofMesh`
ofMesh mesh;
ofNode node;

This code is not tested, but maybe it can gives you an idea.