Ho to make dynamic body inmune to collisions

toglia

06-05-2008 02:45:48

I know there's some stuff like making the body "static:yes" or:
Body->raiseBodyFlag(NX_BF_FROZEN);

But the thing is that sometimes I'm adding torque to a body by code while some actors are colliding with it, and if these actors are heavy enough they can make my body reduce its torque meaningfully which is exactly what I don't want.

What I need is that this body doesn't change its direction, angular velocity or torque cause of collisions with other actors.

BTW, whats the differece between:
Body->getNxActor()->raiseActorFlag(NX_AF_DISABLE_COLLISION);
Body->getNxActor()->raiseActorFlag(NX_AF_DISABLE_RESPONSE);

Thanks!

betajaen

06-05-2008 10:44:19

I had a similar situation in Cake when I added new Camera code (It's an Actor now, allowing me to collide with the Scene). This is how I did it.

ActorParams actorParams;
actorParams.setToDefault();
actorParams.mMass = 1;
actorParams.mDensity = 0;
actorParams.mLinearDamping = 10;
actorParams.mAngularDamping = 10;
actorParams.mBodyFlags |= NX_BF_DISABLE_GRAVITY;
actorParams.mBodyFlags |= NX_BF_FROZEN_ROT;

NxOgre::Pose actorPose(
Vector3(0,15,22)
);

mActor = scene->createBody("CakeSmartCamera", new NxOgre::Sphere(0.25f), actorPose, renderableParams, actorParams);



You could also look at "Dominance Groups", if you plan to move them around a lot.