z789017890
18-08-2010 15:44:38
when two box collision
how to delete One of the box?
betajaen
18-08-2010 15:52:54
If your on about not being able to delete a actor/body in a collision event, then:
You need to make a note of the Box pointer somewhere and then delete it. Usually in your render loop.
z789017890
19-08-2010 00:38:04
how can i to do it?
any code to Reference?
sorry for my poor english
thank's your help
betajaen
19-08-2010 09:53:25
I don't have exact code, because I don't know what your application is like, but this roughly how it goes.:
1. In your code somewhere have member variable: Actor* mDeleteActor (or if your really daring a vector of them). Make sure the pointers are set to zero in your class constructor.
2. When your collision event happens and you want to delete the actor, set mDeleteActor to that pointer. (mDeleteActor = actor).
3. Then in your FrameListener or game loop, have an if statement checking to see if "mDeleteActor" is not null. If it's not null, then delete that pointer, and then set it to zero again.
z789017890
21-08-2010 02:02:58
my code:
mBody = mRenderSystem->createBody(NxOgre::BoxDescription(1,1,1), NxOgre::Vec3(0,5,0), "cube.1m.mesh", bodyDescription);
mBody2=mRenderSystem->createBody(NxOgre::BoxDescription(1,1,1), NxOgre::Vec3(0,15,0), "cube.1m.mesh", bodyDescription);
mScene->setActorFlags(mBody,mBody2,NxOgre::Enums::ContactPairFlags_All);
mBody->setContactCallback(this);
mBody2->setContactCallback(this);
on collision how can i to delete the mBody2?
betajaen
21-08-2010 09:28:29
I've just told you. Just read my last post.
z789017890
29-08-2010 02:40:27
in the
void NxOgreApplication::onContact(const NxOgre::ContactPair &pair)
{
}
i can't get the Actor.
JUST the NxActor?
and how can i to get the Actor?
betajaen
10-09-2010 22:25:51
You get the Actor from the pair argument. You need to delete it in your game loop, not in the contact callback - otherwise PhysX will crash.