[ODE] dBodyGet*
amundbørsand
amund at c2i.net
Wed Mar 19 17:35:02 2003
Hello all,
Sorry to bother you with such a simple question in these exciting
iterative days ;) But here it comes:
I am struggling with the dBodyGet-functions. I am writing my own
ODE/OpenGL-framework, borrowing some code from Drawstuff where I'm stuck.
The problems arise when I'm trying to write a function for drawing a
polygon model, rotated and located according to an ODE dBody. The ODE
examples use statements like
dsDrawBox(dGeomGetPosition(ground_box[i]),dGeomGetRotation(ground_box[i]),ss);
This function is defined as
extern "C" void dsDrawBox (const float pos[3], const float R[12],
const float sides[3])
In here, these things happen that are of my interest:
setTransform (pos,R);
drawBox (sides);
SetTransform take parameters of the same form as dsDrawBox, put them
into an OpenGL matrix and pushes it to the OpenGL stack, and then
drawBox just pushes the polygons normally. Fine.
But, when I try to do the same, my program crashes immediately. It seems
to be when I'm trying to read anything from the parameters (pos and R).
Also, there seem to be no other way to get the results from for instance
dBodyGetRotation than to make a function that take a const dReal [12] as
a parameter. If I try to set up something like this:
dReal *R=dBodyGetRotation(myBody);
the compiler complains that "assignment to `dReal *' from `const dReal *'
discards qualifiers". I'm not sure I understand what "const" really
means in this context, but if I change to
const dReal *R=dBodyGetRotation(myBody);
everything compiles fine, but crashes immediately.
What am I doing wrong? How am I supposed to read these values? Any and
all help is greatly appreciated.
--
amundbørsand <amund@c2i.net>