Disabling collision

dbrock

19-03-2008 23:46:18

Hey guys,

I want to quickly disable collision between my door, and the level body. When I create a joint to have my door rotate, it jumps around because its colliding with small parts of the level. I still want to keep collision between the player and the door though so he can at least open it =).

This would be done with ActorGroups right?

betajaen

19-03-2008 23:55:57

Yeah, but that's the long and complicated way.

Have you tried limiting the joint? So it doesn't hit the level when you open it. I think it's SwingLimits for RevoluteJoints (in the JointParams).

NoodlesOnMyBack

20-03-2008 11:36:57

If you ever come along with Ragdolls this will be usefull too, but as Betajaen said, you just limit the joints.This piece of code simulates the joint of an arm with a torso, so you have 'normal' twisting of the limbs.
Just change it to the properties of your door


NxSphericalJointDesc sphericalDesc;

sphericalDesc.setGlobalAnchor(nxvec);
sphericalDesc.setGlobalAxis(Axis);

sphericalDesc.flags |= NX_SJF_TWIST_LIMIT_ENABLED;
sphericalDesc.twistLimit.low.value = -(NxReal)0.025*NxPi;
sphericalDesc.twistLimit.low.hardness = 0.5;
sphericalDesc.twistLimit.low.restitution = 0.5;
sphericalDesc.twistLimit.high.value = (NxReal)0.025*NxPi;
sphericalDesc.twistLimit.high.hardness = 0.5;
sphericalDesc.twistLimit.high.restitution = 0.5;

sphericalDesc.flags |= NX_SJF_SWING_LIMIT_ENABLED;
sphericalDesc.swingLimit.value = (NxReal)0.25*NxPi;
sphericalDesc.swingLimit.hardness = 0.5;
sphericalDesc.swingLimit.restitution = 0.5;

sphericalDesc.flags |= NX_SJF_TWIST_SPRING_ENABLED;
sphericalDesc.twistSpring.spring = 0.5;
sphericalDesc.twistSpring.damper = 1;

sphericalDesc.flags |= NX_SJF_SWING_SPRING_ENABLED;
sphericalDesc.swingSpring.spring = 0.5;
sphericalDesc.swingSpring.damper = 1;

sphericalDesc.projectionDistance = (NxReal)0.15;
sphericalDesc.projectionMode = NX_JPM_POINT_MINDIST;

JointParams jp;
jp.setToDefault();
jp.fromNxJointDesc(sphericalDesc);

mScene->createSphericalJoint(a1,a2,pos,jp);

betajaen

20-03-2008 11:56:27

Yep. I've just checked with the RevoluteJoint code and JointParams. You need to set these:

- mUpperLimit
- mLowerLimit

In the JointParams when you pass it onto your createRevoluteJoint method when you create your door. More information about joint limits are in the PhysXDocumentation.

dbrock

20-03-2008 17:45:36

Yeah, I've been using the limits. I can get the door to swing open 90 degrees (with a lower limit of 0.45f * NxPi, and an upper limit of 0), and it closes once the player is out of the way, but it still twitches out because theres small parts of it touching the level walls.

It's not that the door twitches once you open it, and it spins right around into the wall, its that there are small parts of it touching the wall in its initial position, at least it seems so when looking at the physx debugger. So I was thinking of just disabling the collision between the level and the door (maybe I can add both the level and all doors to the same group, and disable collision within' that group if its possible?)

I was able to get my ragdolls working without any problems, a little tweaks here and there, but they've been finalized.