MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / prepareData

Method prepareData

physx/source/physxextensions/src/ExtD6Joint.cpp:277–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277void* D6Joint::prepareData()
278{
279 D6JointData& d = data();
280
281 if(mRecomputeMotion)
282 {
283 mRecomputeMotion = false;
284
285 d.driving = 0;
286 d.limited = 0;
287 d.locked = 0;
288
289 for(PxU32 i=0;i<PxD6Axis::eCOUNT;i++)
290 {
291 if(d.motion[i] == PxD6Motion::eLIMITED)
292 d.limited |= 1<<i;
293 else if(d.motion[i] == PxD6Motion::eLOCKED)
294 d.locked |= 1<<i;
295 }
296
297 // a linear direction isn't driven if it's locked
298 if(active(PxD6Drive::eX) && d.motion[PxD6Axis::eX]!=PxD6Motion::eLOCKED) d.driving |= 1<< PxD6Drive::eX;
299 if(active(PxD6Drive::eY) && d.motion[PxD6Axis::eY]!=PxD6Motion::eLOCKED) d.driving |= 1<< PxD6Drive::eY;
300 if(active(PxD6Drive::eZ) && d.motion[PxD6Axis::eZ]!=PxD6Motion::eLOCKED) d.driving |= 1<< PxD6Drive::eZ;
301
302 // SLERP drive requires all angular dofs unlocked, and inhibits swing/twist
303
304 const bool swing1Locked = d.motion[PxD6Axis::eSWING1] == PxD6Motion::eLOCKED;
305 const bool swing2Locked = d.motion[PxD6Axis::eSWING2] == PxD6Motion::eLOCKED;
306 const bool twistLocked = d.motion[PxD6Axis::eTWIST] == PxD6Motion::eLOCKED;
307
308 if(active(PxD6Drive::eSLERP) && !swing1Locked && !swing2Locked && !twistLocked)
309 d.driving |= 1<<PxD6Drive::eSLERP;
310 else
311 {
312 if(active(PxD6Drive::eTWIST) && !twistLocked)
313 d.driving |= 1<<PxD6Drive::eTWIST;
314 if(active(PxD6Drive::eSWING) && (!swing1Locked || !swing2Locked))
315 d.driving |= 1<< PxD6Drive::eSWING;
316 }
317 }
318
319 this->D6JointT::prepareData();
320
321 return mData;
322}
323
324bool D6Joint::attach(PxPhysics &physics, PxRigidActor* actor0, PxRigidActor* actor1)
325{

Callers 1

updateConstantsMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected