void FPhysScene::AddTorque(FBodyInstance * BodyInstance, const FVector & Torque) { #if WITH_PHYSX if (PxRigidDynamic * PRigidDynamic = BodyInstance->GetPxRigidDynamic()) { #if WITH_SUBSTEPPING if (IsSubstepping()) { FPhysSubstepTask * PhysSubStepper = PhysSubSteppers[SceneType(BodyInstance)]; PhysSubStepper->AddTorque(BodyInstance, Torque); } else #endif { SCOPED_SCENE_WRITE_LOCK(PRigidDynamic->getScene()); PRigidDynamic->addTorque(U2PVector(Torque), PxForceMode::eFORCE, true); } } #endif }
void FPhysScene::AddTorque(FBodyInstance* BodyInstance, const FVector& Torque, bool bAllowSubstepping) { #if WITH_PHYSX if (PxRigidBody * PRigidBody = BodyInstance->GetPxRigidBody()) { #if WITH_SUBSTEPPING uint32 BodySceneType = SceneType(BodyInstance); if (bAllowSubstepping && IsSubstepping(BodySceneType)) { FPhysSubstepTask * PhysSubStepper = PhysSubSteppers[BodySceneType]; PhysSubStepper->AddTorque(BodyInstance, Torque); } else #endif { SCOPED_SCENE_WRITE_LOCK(PRigidBody->getScene()); PRigidBody->addTorque(U2PVector(Torque), PxForceMode::eFORCE, true); } } #endif }