wraith
11-07-2009 12:57:16
So I have all of my Nx physics encapsulated in one singleton class, and I initialise this when my Ogre scene is rendered. the variable mScene, which is the NxOgre scene is created and used for creating Nx bodies. This all works fine. My mScene variable is definitely initialised. I use
when the physics class is initialised to set up collision groups. This also works fine. However, once everything is rendered, in my frame listener I have a keypress which calls the following code in my physics class:
This doesn't work however, and I get an access violation. I'm fairly certain the problem is in the getScene() call, but I have no idea why. The bodies being passed are definitely initialised (I can see them in the scene) so I'm stumped as to what's going wrong. Does anyone have any clue as to what's going wrong?
mScene->getScene()->setActorGroupPairFlags()
when the physics class is initialised to set up collision groups. This also works fine. However, once everything is rendered, in my frame listener I have a keypress which calls the following code in my physics class:
void Physics::SetActorContactReport(OGRE3DBody* body1, OGRE3DBody* body2, int flag) {
NxActor* b1=body1->getNxActor();
NxActor* b2=body2->getNxActor();
mScene->getScene()->setActorPairFlags((NxActor&)b1,(NxActor&)b2, flag);
}
This doesn't work however, and I get an access violation. I'm fairly certain the problem is in the getScene() call, but I have no idea why. The bodies being passed are definitely initialised (I can see them in the scene) so I'm stumped as to what's going wrong. Does anyone have any clue as to what's going wrong?