Pointer issue

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
booster
Posts: 15
Joined: Thu Nov 19, 2015 8:53 pm

Pointer issue

Post by booster »

Hi, I feel so rusty, lol and confused!

Basically I'm running a test, it involves writing out a list of positions of a node.

I've tried this numerous ways, but here's the current version premise:

Code: Select all

 
ISceneNode *nod =  (ISceneNode*)dGeomGetData(rec_id);
core::vector3df pos = nod->getPosition();
rec->add(pos);
 
thw add function:

Code: Select all

 
void add(vector3df pos){
    nums.push_back(RXVec(pos.X,pos.Y,pos.Z));
}
 
At rec->add() I get a SIGSEGV!


I also tried:

Code: Select all

 
dReal* ode_pos =(dReal*)dGeomGetPosition(rec_id);
rec->add((float)ode_pos[0],(float)ode_pos[1],(float)ode_pos[2]);
 
But I was getting issues trying to dereference the pointers...


Just in case, rec_id prints out as hex, and comes from a vector of dGeomID's:

Code: Select all

 
dGeomID rec_id = (dGeomID)geoms[1];
 
It updates the physics / Irrlicht ok, so I'm guessing that the ID is good.

Any ideas or guidance please.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Pointer issue

Post by Seven »

where do you instantiate the variable rec?

since you are using rec-> you must be doing something like
some_variable_type* rec = new some_variable_type();

and then you can use rec->someFunction();
Post Reply