"Not suported types of constraints used to build a chain!" when building a PoweredChainMapper

"Not suported types of constraints used to build a chain!" when building a PoweredChainMapper

I can sucsesfully create chains however when i try to build ahkpPoweredChainMapper thehkpPoweredChainMapper::buildChainMapper gives me these 3 warnings warnings in a row:
"Unsuported type of constraint in prepareSystemForRagdoll()"
"Not suported types of constraints used to build a chain!""Failed to build chain"As the manual clearly shows and as the build function demands i supply it ahkArray of hkpConstraintInstance pointers.Here is the source, everything has been tested and works well till the build function:

	physics.addBox(0,0,0,100,100,1,0.5);//Floor

	primary = physics.addBox(0,2,25,1.5,6,3.5);

	secondary = physics.addBox(0,2,35,1.5,6,3.5);	

	hkpPoweredChainData* pChainData;
	hkpConstraintChainInstance *pChainInstance;

	hkVector4 pivotA(0,0,-5);
	hkVector4 pivotB(0,0,5);

	pChainData = new hkpPoweredChainData();
	pChainInstance = new hkpConstraintChainInstance(pChainData);

	hkpPositionConstraintMotor* xMotor = new hkpPositionConstraintMotor();
	{
		xMotor->m_tau = 0.1f;
		xMotor->m_maxForce = 1.0f;
		xMotor->m_damping = 0.1f;
		xMotor->m_constantRecoveryVelocity = 0.1f;
		xMotor->m_proportionalRecoveryVelocity = 1.1f;
	}
	hkpPositionConstraintMotor* yMotor = new hkpPositionConstraintMotor(*xMotor);
	hkpPositionConstraintMotor* zMotor = new hkpPositionConstraintMotor(*xMotor);

	pChainInstance->addEntity(primary);

	pChainData->addConstraintInfoInBodySpace(pivotA,pivotB,hkQuaternion::getIdentity(),xMotor,yMotor,zMotor);		

	pChainInstance->addEntity(secondary);

	physics.m_world->addConstraint(pChainInstance);

	hkArray allConstraints;//Make array for the chain mapper containing the one and only chain
	allConstraints.pushBack(pChainInstance);

	hkpPoweredChainMapper::Config config;
	config.m_createLimitConstraints = true;
	config.m_cloneMotors = true;

	hkArray pairs;

	pairs.expandOne();
	pairs.back().m_start = primary;
	pairs.back().m_end	 = secondary;

	hkpPoweredChainMapper* chMapper = hkpPoweredChainMapper::buildChainMapper(config,
		allConstraints,
		pairs);

Investigating the warnings, they tell that i somehow should use another "type" of constraint. I dont however see any openings as of where i can supply some sort of other type of constraint.
There are some places where the hkpConstraintChainInstance could be changed to a hkpConstraintInstance and vice versa, however these changes either give intellisence errors or just simply wont help.Thanks in Advance, Havok admirer David.

4 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

Hi,

In the code above, you seem to be supplying a single hkpConstraintChainInstance as you list of hkpConstraintInstance's.

hkpPoweredChainMapper::buildChainMapper(...) takes an array of hkpConstraintInstance's and builds the hkpConstraintChainInstance's for you, returning them as part of the hkpPoweredChainMapper.

You need to supply a list of constraint instances, each of which is CONSTRAINT_TYPE_BALLANDSOCKET, CONSTRAINT_TYPE_HINGE, CONSTRAINT_TYPE_LIMITEDHINGE or CONSTRAINT_TYPE_RAGDOLL.
If you're trying to use this for a ragdoll, those constraint instances will come straight from your ragdoll definition.

Cheers,
Cormac

OK but it requires powered constraints with motors. I cant supply a motor for thehkpBallAndSocketConstraint. Isnt the poweredChain a ball and socket constraint with a motor? But the only way to access its motors is by building a PoweredChainMapper, and then again i cant build one with the ball and socket constraints since i would have to supply its powered counterpart the poweredChain...Paradox!?Probably not, what am i missing, how can i power a ball and socket constraint(without using a powered chain?/no?) and build a chain mapper of it?

Maybe try using ragdoll constraints - they're basically ball-and-socket constraints with some clever limits.
As far as I recall, you can only use motors on constraints that have limits.

You can play around with adjusting the ragdoll limits to allow the kind of motion you want.
(The visual debugger can help with visualising the limits).

One other thing - do you have multiple constraints in a chain or only one ball-and-socket?
Maybe I'm wrong, but your reply seemed to indicate you were only using a powered chain to drive a single constraint. If that's the case, you're better off with just a motor (which should work with the ragdoll constraint).

Cormac

Accedere per lasciare un commento.