diff options
Diffstat (limited to 'NvCloth/src/IterationState.h')
| -rw-r--r-- | NvCloth/src/IterationState.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/NvCloth/src/IterationState.h b/NvCloth/src/IterationState.h index e18b636..be046b5 100644 --- a/NvCloth/src/IterationState.h +++ b/NvCloth/src/IterationState.h @@ -183,11 +183,15 @@ cloth::IterationStateFactory::IterationStateFactory(MyCloth& cloth, float frameD mPrevLinearVelocity = cloth.mLinearVelocity; mPrevAngularVelocity = cloth.mAngularVelocity; - // update cloth - float invFrameDt = 1.0f / frameDt; - cloth.mLinearVelocity = invFrameDt * (cloth.mTargetMotion.p - cloth.mCurrentMotion.p); - physx::PxQuat dq = cloth.mTargetMotion.q * cloth.mCurrentMotion.q.getConjugate(); - cloth.mAngularVelocity = log(dq) * invFrameDt; + if(!cloth.mIgnoreVelocityDiscontinuityNextFrame) + { + // update cloth + float invFrameDt = 1.0f / frameDt; + cloth.mLinearVelocity = invFrameDt * (cloth.mTargetMotion.p - cloth.mCurrentMotion.p); + physx::PxQuat dq = cloth.mTargetMotion.q * cloth.mCurrentMotion.q.getConjugate(); + cloth.mAngularVelocity = log(dq) * invFrameDt; + } + cloth.mIgnoreVelocityDiscontinuityNextFrame = false; cloth.mPrevIterDt = mIterDt; cloth.mIterDtAvg.push(static_cast<uint32_t>(mNumIterations), mIterDt); |