Hi,I’m a newer to physX ,recently I run a simulation of a robot with physX and I need the contact force between the robot’s foot and ground. but I cann’t find such method in the 3.2 Guide,I google it and find that there have been this method in the old versions physX :
http://www.physxforquest.com/onlinehelp/DynamXChannels/Channels/Support_Channels/contactReport/Contact_Report_Channel.htm
but it seem to be deleted or changed in the 3.2 SDK,can some one help me to get the contact force between 2 actors?
thanks a lot
You want the PxContactPairPoint struct, which you pull from the PxContactPair given to you in an onContact callback. Have a look in the User Guide section “Callbacks and Customization”.
Thanks,
Mike
void onContact(const PxContactPairHeader& pairHeader, const PxContactPair* pairs, PxU32 nbPairs)
{
const PxU32 bufferSize = 100;
PxContactPairPoint contacts[bufferSize];
for(PxU32 i=0; i < nbPairs; i++)
{
const PxContactPair& cp = pairs[i];
if (!(cp.events & (PxPairFlag::eNOTIFY_TOUCH_LOST | PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST)))
{
PxU32 nbContacts = pairs[i].extractContacts(contacts, bufferSize);
for(PxU32 j=0; j < nbContacts; j++)
{
PxVec3 point = contacts[j].position;
PxVec3 impulse = contacts[j].impulse;
PX_ASSERT(impulse.magnitudeSquared() >= 0.0f);
}
}
}
}