jchmack
03-11-2007 08:37:04
Im trying to look for leaks with debug mode. My app runs fine in release but it seems that when i changed over to debug mode i get crashes when using
body::getNxActor().
i got crashes when using any of these:
mBody->getNxActor()->raiseBodyFlag(NX_BF_DISABLE_GRAVITY);
CollisionBody->getNxActor()->raiseActorFlag(NX_AF_DISABLE_COLLISION);
CollisionBody->getNxActor()->raiseBodyFlag(NX_BF_KINEMATIC);
CollisionBody->getNxActor()->putToSleep();
which ran fine when i used the bodys raise body/actor flag
mBody->raiseBodyFlag(NX_BF_DISABLE_GRAVITY);
but i need to set the group of my actors shape like this:
NxShape* const* s = mBody->getNxActor()->getShapes();
(*s)->setGroup(1);
and i cant seem to find a proper conversion.
My app ran fine in 0.9-34 debug AND release and 0.9-38 release just not in debug. Can we not use getNxActor() anymore?
betajaen
03-11-2007 08:39:49
It's probably crashing with what your doing with that NxActor pointer, which I suspect is Null.
See if there are any errors in the log about mBody/CollisionBody or dump that pointer to the console or Ogre log and see what the value is.
jchmack
03-11-2007 08:48:08
all i am doing is setting the group
in my initialization:
mScene->getNxScene()->setGroupCollisionFlag(1,1, false);
when i create an object:
void Skill::SetCollisions()
{
if(Kinematic)
mBody->raiseBodyFlag(NX_BF_KINEMATIC);
else
{
NxShape* const* s = mBody->getNxActor()->getShapes();
//NxShape* const* s = mBody->getNxActor()->getShapes();
(*s)->setGroup(1);
}
}
I had to hack it whenever you took out groups. But i see they are back in now. Are they functional? How do i create a group/ set its collision flags/ add a body to a group?
edit: ok i looked a bit more into the new group system. If i remember correctly there used to be NoCollisionsWith() or a flag or something but i am not seeing anything like that. Just the collision callbacks. How can i create a body add it to a group and make it not collide with bodies of the same group?
betajaen
03-11-2007 08:54:03
ActorGroups and ShapeGroups are demonstrated
here
If your still having trouble with getting the NxActor, cast the Body into an Actor and see how it goes.
jchmack
03-11-2007 09:02:12
Thx for the replies =). I'm still using ancient 0.6 code with 0.9 ill try out the new stuff. I gotta learn to upgrade sooner =).
betajaen
03-11-2007 09:11:12
You should loose 0.6 as quick as possible, it really sucks.
jchmack
03-11-2007 09:16:33
i did already but a lot of my code from 0.6 is still in there.
jchmack
03-11-2007 09:41:28
ok i still can't get my projectiles to not collide with other projectiles:
when i start up:
NxOgre::ShapeGroup* ProjectileShapeGroup = mScene->createShapeGroup("Projectiles");
ProjectileShapeGroup->setCollisionResponse(ProjectileShapeGroup,ShapeGroup::CR_No_Collision);
when i create a body":
ActorParams Params;
Params.setToDefault();
Params.mGroupAsName = "Projectiles";
mBody = mScene->createBody("", new SphereShape(0.1f), NxOgre::Pose(InitialPosition+KinematicOffset,InitialDirection), Params);
My projectiles still bump into each other and i still get a crash in debug mode when one of these projectiles hits my character.
betajaen
03-11-2007 09:43:24
First, try CCD and see if that works. Also if your not going to use a body like that use an Actor, less overhead. Also give it a name, it's tacky like that.
jchmack
03-11-2007 09:58:05
First, try CCD and see if that works. Also if your not going to use a body like that use an Actor, less overhead. Also give it a name, it's tacky like that.
how do i enable CCD?
Last i remember it wasn't supported:
http://www.ogre3d.org/phpBB2addons/view ... hlight=ccd
jchmack
03-11-2007 10:15:30
OK I am not finding a way to set a bodies shape group. I see how to set it's actor group but from what i am seeing i can't add it to a shape group.
I think that Params.mGroupAsName = "Projectiles"; is adding it to the actor group Projectiles, but not to the shape group.
I am not seeing a way to do this either through params or in code. The only way i can get it to work is to add the shape myself:
NxShape* const* s = mBody->getNxActor()->getShapes();
(*s)->setGroup(1);
which works in release but i am trying to run this in debug which gives me a crash because of getNxActor().
betajaen
03-11-2007 10:34:10
Body = Actor, Body's are Actors with a SceneNode and that's it.
//ShapeGroup creation code goes here.
ShapeParams sp;
sp.mGroupAsName = "Projectiles";
mBody = mScene->createScene(.... new WhateverShape(..., sp) ... );
jchmack
03-11-2007 10:42:01
Im sorry i was looking for them in actor params
. Thank you for your patience with me. Its 5 am here.
jchmack
03-11-2007 11:22:20
Sigh it seems that my problems might be a bit deeper... I tried to make this trivial example:
NxOgre::ShapeGroup* ProjectileShapeGroup = mScene->createShapeGroup("Projectiles");
NxOgre::Body* mBody;
ActorParams mActorParams;
ShapeParams mShapeParams;
mActorParams.setToDefault();
mShapeParams.setToDefault();
mShapeParams.mGroupAsName = "Projectiles";
mBody = mScene->createBody("", new SphereShape(0.1f,mShapeParams), NxOgre::Pose(Vector3(0,0,0)), mActorParams);
Its just a basic app. It runs fine in release but it crashes when trying to create the body in debug. If i comment out this line:
mShapeParams.mGroupAsName = "Projectiles";
It runs fine... But Shapegroup + Debug mode = crash (for me at least). Im going to recompile NxOgre and make sure i have the most recent dll.
edit: Well i recompiled NxOgre and copied the DLL. I still get the same results. I am using:
NxOgre (NxOgre 0.9-38.Debug) Started, working with:
- PhysX => 2.7.2
- Ogre => 1.4.0 'Eihort'
- Platform => Windows Debug
I wonder what the hell it is lol.
edit: On a side note the reason i use Body vs Actor is because I use the node that body has. I attach all type of stuff to it (mainly billboards).