probelem with NxActor::userData and wheelset class

maroxe

12-09-2008 01:10:08

Hi
i have ew problem with NxOgre:
for my application,i must handle contact report. But in blending, there isn't a class wich can do that, s i derived directly with NxContactReporter.
to have acces to NxOgre::Actor from NxActor(cause Physx dosn't know NxActor::Actor class), i do like that inside my body(derived from NxOgre::Actor) class constructor:

NxActor->userData = this
the probleme apprears with vehicle: the wheelset class use NxActor's userData, so if i modify it directly, the program crashes.
Is there any issue?

betajaen

12-09-2008 08:51:10

Yes. Don't use the userData, it's NxOgre's and NxOgre's only.

If you have to look at it, then you can cast it into a VoidPointer, then from that get the type of class stored and use one of the casting functions from that.

If you mess around with the userData; your going to make things crash.

maroxe

12-09-2008 11:04:27

is there any other way to get pointer to NxOgre::Actor from NxActor?

betajaen

12-09-2008 11:33:11

you can cast it into a VoidPointer, then from that get the type of class stored and use one of the casting functions from that.

maroxe

12-09-2008 13:19:54

sorry, i don't understand but you mean
do you advise to me to do that?:

userData = static_cast<VoidPointer*> MyData;
won't it cause conflict?

betajaen

12-09-2008 14:25:00

That's just silly.

VoidPointer* vp = static_cast<VoidPointer>(nx_actor->userData);
Actor* actor = vp->toActor();

maroxe

12-09-2008 19:12:46

so actor pointer is already save in userData pointer?

betajaen

12-09-2008 19:18:50

Yes. But it's carefully put in there, and you can't touch it.

maroxe

12-09-2008 19:37:15

ok thanks, so the problem solves itself :D