本文整理汇总了C++中FBodyInstance::ShouldInstanceSimulatingPhysics方法的典型用法代码示例。如果您正苦于以下问题:C++ FBodyInstance::ShouldInstanceSimulatingPhysics方法的具体用法?C++ FBodyInstance::ShouldInstanceSimulatingPhysics怎么用?C++ FBodyInstance::ShouldInstanceSimulatingPhysics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FBodyInstance
的用法示例。
在下文中一共展示了FBodyInstance::ShouldInstanceSimulatingPhysics方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WeldToImplementation
bool UPrimitiveComponent::WeldToImplementation(USceneComponent * InParent, FName ParentSocketName /* = Name_None */, bool bWeldSimulatedChild /* = false */)
{
//WeldToInternal assumes attachment is already done
if (AttachParent != InParent || AttachSocketName != ParentSocketName)
{
return false;
}
//Check that we can actually our own socket name
FBodyInstance* BI = GetBodyInstance(NAME_None, false);
if (BI == NULL)
{
return false;
}
if (BI->ShouldInstanceSimulatingPhysics() && bWeldSimulatedChild == false)
{
return false;
}
UnWeldFromParent(); //make sure to unweld from wherever we currently are
FName SocketName;
UPrimitiveComponent * RootComponent = GetRootWelded(this, ParentSocketName, &SocketName, true);
if (RootComponent)
{
if (FBodyInstance* RootBI = RootComponent->GetBodyInstance(SocketName, false))
{
if (BI->WeldParent == RootBI) //already welded so stop
{
return true;
}
BI->bWelded = true;
//There are multiple cases to handle:
//Root is kinematic, simulated
//Child is kinematic, simulated
//Child always inherits from root
//if root is kinematic simply set child to be kinematic and we're done
if (RootComponent->IsSimulatingPhysics(SocketName) == false)
{
BI->WeldParent = NULL;
SetSimulatePhysics(false);
return false; //return false because we need to continue with regular body initialization
}
//root is simulated so we actually weld the body
FTransform RelativeTM = RootComponent == AttachParent ? GetRelativeTransform() : GetComponentToWorld().GetRelativeTransform(RootComponent->GetComponentToWorld()); //if direct parent we already have relative. Otherwise compute it
RootBI->Weld(BI, GetComponentToWorld());
BI->WeldParent = RootBI;
return true;
}
}
return false;
}