physx-js-webidl
physx-js-webidl copied to clipboard
some help about articulation
Hi i need some help for articulation i know how to init / add bone but i have problem to get joint
init is
this.chain = this.useReducer ? root.world.createArticulationReducedCoordinate() : root.world.createArticulation()
// bone is
var bone = this.chain.createLink( parent || null, transform );
joint should be
joint = this.bones[ o.bone ].getInboundJoint()
on reducer i should have a PxArticulationJointReducedCoordinate but i have a PxArticulationJointBase i try joint = PhysX.TypeHelpers.prototype.articulationBaseJointToJoint( joint ) but i get a PxArticulationJoint
in doc i have
PxArticulationJoint* joint = static_cast<PxArticulationJoint*>(link->getInboundJoint());
for non reduced and
PxArticulationJointReducedCoordinate* joint = static_cast<PxArticulationJointReducedCoordinate*>(link->getInboundJoint());
for reduced
Ah I guess the cast function for reduced joint is missing in TypeHelpers. Should be easy to add (I'm not sure when I will have time to do that though).
I never tried the reduced coordinate articulations, the normal ones already were good enough (according to the doc the reduced coordinate version is more accurate and slower).
yes i try to add typeHelpers but not work joint stay fixed reduced is more interesting because have many more option and work like standard joint
basic articulation is for chaine or rope but reduced is for robot arm, leg, kinematic ... reduced have drive on joint and can be spherical, prismatic, revolute...
i try
TypeHelpers.prototype['articulationBaseJointToJointReduced'] = TypeHelpers.prototype.articulationBaseJointToJointReduced = /** @suppress {undefinedVars, duplicate} @this{Object} */function(baseJoint) {
var self = this.ptr;
if (baseJoint && typeof baseJoint === 'object') baseJoint = baseJoint.ptr;
return wrapPointer(_emscripten_bind_TypeHelpers_articulationBaseJointToJoint_1(self, baseJoint), PxArticulationJointReducedCoordinate);
};;
now i have access of joint propriety but joint stay fixed :(
wow that work !!
i just make error in definition ( missing () at end )
joint.setJointType( PhysX[ '_emscripten_enum_PxArticulationJointTypeEnum_e'+ o.type.toUpperCase() ]() )
so just need add new TypeHelpers proto
Alright, I added the TypeHelper function. Updated lib is available in dist directory. I haven't published it on npmjs yet in case more changes come up.