本文整理汇总了C++中FPhysScene::SetUpForFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ FPhysScene::SetUpForFrame方法的具体用法?C++ FPhysScene::SetUpForFrame怎么用?C++ FPhysScene::SetUpForFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPhysScene
的用法示例。
在下文中一共展示了FPhysScene::SetUpForFrame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupPhysicsTickFunctions
void UWorld::SetupPhysicsTickFunctions(float DeltaSeconds)
{
StartPhysicsTickFunction.bCanEverTick = true;
StartPhysicsTickFunction.Target = this;
EndPhysicsTickFunction.bCanEverTick = true;
EndPhysicsTickFunction.Target = this;
StartClothTickFunction.bCanEverTick = true;
StartClothTickFunction.Target = this;
EndClothTickFunction.bCanEverTick = true;
EndClothTickFunction.Target = this;
// see if we need to update tick registration
bool bNeedToUpdateTickRegistration = (bShouldSimulatePhysics != StartPhysicsTickFunction.IsTickFunctionRegistered())
|| (bShouldSimulatePhysics != EndPhysicsTickFunction.IsTickFunctionRegistered())
|| (bShouldSimulatePhysics != StartClothTickFunction.IsTickFunctionRegistered())
|| (bShouldSimulatePhysics != EndClothTickFunction.IsTickFunctionRegistered());
if (bNeedToUpdateTickRegistration && PersistentLevel)
{
if (bShouldSimulatePhysics && !StartPhysicsTickFunction.IsTickFunctionRegistered())
{
StartPhysicsTickFunction.TickGroup = TG_StartPhysics;
StartPhysicsTickFunction.RegisterTickFunction(PersistentLevel);
}
else if (!bShouldSimulatePhysics && StartPhysicsTickFunction.IsTickFunctionRegistered())
{
StartPhysicsTickFunction.UnRegisterTickFunction();
}
if (bShouldSimulatePhysics && !EndPhysicsTickFunction.IsTickFunctionRegistered())
{
EndPhysicsTickFunction.TickGroup = TG_EndPhysics;
EndPhysicsTickFunction.RegisterTickFunction(PersistentLevel);
EndPhysicsTickFunction.AddPrerequisite(this, StartPhysicsTickFunction);
}
else if (!bShouldSimulatePhysics && EndPhysicsTickFunction.IsTickFunctionRegistered())
{
EndPhysicsTickFunction.RemovePrerequisite(this, StartPhysicsTickFunction);
EndPhysicsTickFunction.UnRegisterTickFunction();
}
//cloth
if (bShouldSimulatePhysics && !StartClothTickFunction.IsTickFunctionRegistered())
{
StartClothTickFunction.TickGroup = TG_StartCloth;
StartClothTickFunction.RegisterTickFunction(PersistentLevel);
}
else if (!bShouldSimulatePhysics && StartClothTickFunction.IsTickFunctionRegistered())
{
StartClothTickFunction.UnRegisterTickFunction();
}
if (bShouldSimulatePhysics && !EndClothTickFunction.IsTickFunctionRegistered())
{
EndClothTickFunction.TickGroup = TG_EndCloth;
EndClothTickFunction.RegisterTickFunction(PersistentLevel);
EndClothTickFunction.AddPrerequisite(this, StartClothTickFunction);
}
else if (!bShouldSimulatePhysics && EndClothTickFunction.IsTickFunctionRegistered())
{
EndClothTickFunction.RemovePrerequisite(this, StartClothTickFunction);
EndClothTickFunction.UnRegisterTickFunction();
}
}
FPhysScene* PhysScene = GetPhysicsScene();
if (PhysicsScene == NULL)
{
return;
}
#if WITH_PHYSX
// When ticking the main scene, clean up any physics engine resources (once a frame)
DeferredPhysResourceCleanup();
#endif
// Update gravity in case it changed
FVector DefaultGravity( 0.f, 0.f, GetGravityZ() );
static const auto CVar_MaxPhysicsDeltaTime = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("p.MaxPhysicsDeltaTime"));
PhysScene->SetUpForFrame(&DefaultGravity, DeltaSeconds, UPhysicsSettings::Get()->MaxPhysicsDeltaTime);
}