Problems setting up constraint frames for joints

I need help again please :)

I want to join two capsules using a fixed joint. I’ve included a simple bit of code which demonstrates what I want to do. I want the capsules joind at 90 degrees to each other. I can join them when they are in a straight line but not when they are at an angle. When I run the code below they spawn in the correct place but then almost immediately rotate to overlap each other in a straight line. I guess I need to do something with the transforms but whatever I try either results in a weird angle or getting an assert error saying something about "!isSane() which I assume means the engine is trying to do something with the transforms I’ve given it which it can’t do (probably parallel and it’s doing a cross product or something?)

Anyway I can’t work out what I should put in two constraint frames to make it work.

If anyone can help I would be most obliged :)


Tony Oakden

void PhysTutorial::joinTest()
	PxCapsuleGeometry capsule(1,5);
	PxTransform t1 = PxTransform(PxVec3(0,0,0));
	PxTransform t2 = PxTransform(PxVec3(-6,6,0),PxQuat(PxPi/2.0f,Z_AXIS));
	float density = 1;
	PxRigidDynamic* a1 = PxCreateDynamic(*g_Physics, t1, capsule,*g_PhysicsMaterial, density);
	PxRigidDynamic* a2 = PxCreateDynamic(*g_Physics, t2, capsule,*g_PhysicsMaterial, density);
	PxTransform a1ConstraintFrame = PxTransform(PxVec3(-6,0,0));
	PxTransform a2ConstraintFrame = PxTransform(PxVec3(-6,0,0));
	PxFixedJoint* joint =PxFixedJointCreate(*g_Physics,a1,a1ConstraintFrame,a2,a2ConstraintFrame);