A question about NxActor userdata.

jchmack

30-10-2007 08:22:45

Does NxOgre use the NxActors userdata for anything. I was going to use this to link the actors back to my classes but it seems that if i null them:

CollisionBody->getNxActor()->userData = NULL;

I get a crash when NxOgre renders pointing here:


void World::render(NxReal time) {

for(Scene* scene = mScenes.begin();scene = mScenes.next();) {
scene->render(time);
}

}

jchmack

30-10-2007 08:43:36

ok i found this thread:

http://www.ogre3d.org/phpBB2addons/view ... data#29773

basically it says to make my objects based off actor.

so how can i get one of my corresponding objects from something like an intersection which returns actor ptrs?

betajaen

30-10-2007 09:14:49

You static cast the Actor to your Class.

Problem is I've just figured out, you need to know before hand what type of Actor it is before you cast it. Perhaps I should have a virtual getType() function like Ogre's MovableObjects.

jchmack

30-10-2007 19:07:34

well personally (for now) it sounds easier to just add a void pointer to the NxOgre::actor class myself. Seems like less code to write because i can just static cast the void ptr to a class i already have written. Not to mention Having to derive and register any future class (that i plan to have an actor) from actor. Ill try both and see what i like.

Thx for the help.