[ODE] dBodyGet*
amundbørsand
amund at c2i.net
Thu Mar 20 02:59:02 2003
Nate W <coding@natew.com> skreiv:
> The compiler requires that you store the results in a "const dReal *" so
> that it stays const. If you assigned it to a non-const "dReal *" then the
> compiler wouldn't know you weren't supposed to change it, so it would let
> you change it, that would be bad. (You can actually assign to a non-const
> object, using a cast, but you shouldn't.)
But how are one supposed to read these values? The only place (it seems)
where I'm allowed to make a const *dReal variable and being able to
assign the result from dBodyGetRotation is as a parameter to a function.
Is there no "normal" way to read these values? Can somebody provide a
code snippet?
> > const dReal *R=dBodyGetRotation(myBody);
> > everything compiles fine, but crashes immediately.
> In any case, I'd suspect that myBody doesn't refer to an actual Body.
> Any chance you're passing in a bogus value there?
I am actually suspecting it, I'll double check. But even if that's what
causes the crash I would still like a simpler and less clumsy way to
read the matrix (and position), other than having to make a function
which gets the stuff as parameters.