gmz1982
07-03-2009 09:14:51
Hi!
I have been trying to work with Character Controllers starting with the given PhysX tutorials. I created a capsule shaped controller and a box actor. I can push the box on the ground.
After that I tried to work with callbacks but the app crashes when the capsule and the box shapes are colliding.
As you can see, callbacks are commented out right now, with or without it the code crashes if I use "SetActorCollisionGroup( mActor->getNxActor(), GROUP_COLLIDABLE_NON_PUSHABLE )"
or I use setGroup on all the shapes manually.
I use NxOgre 1.0 '21 and I move the controller with the code below:
Any response would be helpful!
Thanks in advance!
I have been trying to work with Character Controllers starting with the given PhysX tutorials. I created a capsule shaped controller and a box actor. I can push the box on the ground.
After that I tried to work with callbacks but the app crashes when the capsule and the box shapes are colliding.
enum GameGroup
{
GROUP_NON_COLLIDABLE,
GROUP_COLLIDABLE_NON_PUSHABLE,
GROUP_COLLIDABLE_PUSHABLE,
};
#define COLLIDABLE_MASK (1<<GROUP_COLLIDABLE_NON_PUSHABLE) | (1<<GROUP_COLLIDABLE_PUSHABLE)
NxControllerManager* gManager;
NxController *cm_controller;
NxController *charcont;
void SetActorCollisionGroup(NxActor *actor, NxCollisionGroup group)
{
NxU32 nbShapes = actor->getNbShapes();
NxShape*const* shapes = actor->getShapes();
while (nbShapes--)
{
shapes[nbShapes]->setGroup(group);
}
}
NxController* PX_createCharacterController()
{
NxOgre::UserAllocator gMyAllocator;
gManager = NxCreateControllerManager(&gMyAllocator);
NxCapsuleControllerDesc desc;
desc.setToDefault();
desc.radius = 25;
desc.height = 60;
desc.upDirection = NX_Y;
desc.slopeLimit = 0;
desc.skinWidth = 0.01f;
desc.stepOffset = 5.0;
desc.position.x = 0;
desc.position.y = 30;
desc.position.z = 0;
desc.callback = NULL;
//desc.callback = &gControllerHitReport;
cm_controller = gManager->createController(PXScene->getNxScene(), desc);
cm_controller->setCollision( true );
return cm_controller;
};
mActor = PXScene->createActor("TestWallActor", new NxOgre::Cube(100.0f), Vector3(100, 110, 100), "mass: 10.0" );
SetActorCollisionGroup( mActor->getNxActor(), GROUP_COLLIDABLE_NON_PUSHABLE );
charcont = PX_createCharacterController();
As you can see, callbacks are commented out right now, with or without it the code crashes if I use "SetActorCollisionGroup( mActor->getNxActor(), GROUP_COLLIDABLE_NON_PUSHABLE )"
or I use setGroup on all the shapes manually.
I use NxOgre 1.0 '21 and I move the controller with the code below:
NxU32 collisionFlags;
NxF32 sharpness = 0.5f;
charcont->move( NxVec3(-speed,0,0), COLLIDABLE_MASK, 0.000001f, collisionFlags, sharpness);
Any response would be helpful!
Thanks in advance!