本文整理汇总了C++中FQuat::GetForwardVector方法的典型用法代码示例。如果您正苦于以下问题:C++ FQuat::GetForwardVector方法的具体用法?C++ FQuat::GetForwardVector怎么用?C++ FQuat::GetForwardVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FQuat
的用法示例。
在下文中一共展示了FQuat::GetForwardVector方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAlignedBox
FVector UAblTargetingBox::GetAlignedBox(const UAblAbilityContext& Context, FTransform& OutQueryTransform) const
{
FVector AlignedBox;
m_Location.GetTransform(Context, OutQueryTransform);
const FQuat QueryRotation = OutQueryTransform.GetRotation();
// Somewhere down the pipeline, the Box rotation is ignored, so go ahead and take care of it here.
AlignedBox = QueryRotation.GetForwardVector() * m_HalfExtents.X;
AlignedBox += QueryRotation.GetRightVector() * m_HalfExtents.Y;
AlignedBox += QueryRotation.GetUpVector() * m_HalfExtents.Z;
// Move out by our Half Extents.
FVector HalfExtentsOffset = QueryRotation.GetForwardVector() * m_HalfExtents.X;
OutQueryTransform *= FTransform(HalfExtentsOffset);
return AlignedBox;
}
示例2: CalculateRange
float UAblTargetingBox::CalculateRange() const
{
FVector RotatedBox;
FQuat Rotation = FQuat(m_Location.GetRotation());
RotatedBox = Rotation.GetForwardVector() + m_HalfExtents.X;
RotatedBox += Rotation.GetRightVector() + m_HalfExtents.Y;
RotatedBox += Rotation.GetUpVector() + m_HalfExtents.Z;
if (m_CalculateAs2DRange)
{
return m_Location.GetOffset().Size2D() + RotatedBox.Size2D();
}
return m_Location.GetOffset().Size() + RotatedBox.Size();
}
示例3: FindTargets
void UAblTargetingBox::FindTargets(UAblAbilityContext& Context) const
{
AActor* SourceActor = m_Location.GetSourceActor(Context);
check(SourceActor);
UWorld* World = SourceActor->GetWorld();
FTransform QueryTransform;
if (IsUsingAsync() && UAbleSettings::IsAsyncEnabled())
{
// Check if we have a valid Async handle already.
if (!Context.HasValidAsyncHandle())
{
FCollisionShape BoxShape = FCollisionShape::MakeBox(m_HalfExtents);
m_Location.GetTransform(Context, QueryTransform);
// Push our query out by our half extents so we aren't centered in the box.
FQuat Rotation = QueryTransform.GetRotation();
FVector HalfExtentsOffset = Rotation.GetForwardVector() * m_HalfExtents.X;
QueryTransform *= FTransform(HalfExtentsOffset);
FTraceHandle AsyncHandle = World->AsyncOverlapByChannel(QueryTransform.GetLocation(), QueryTransform.GetRotation(), GetCollisionChannel(), BoxShape);
Context.SetAsyncHandle(AsyncHandle);
}
else // Poll and see if our query is done, if so - process it.
{
FOverlapDatum Datum;
if (World->QueryOverlapData(Context.GetAsyncHandle(), Datum))
{
ProcessResults(Context, Datum.OutOverlaps);
FTraceHandle Empty;
Context.SetAsyncHandle(Empty); // Reset our handle.
}
return;
}
}
else // Normal Sync Query
{
FCollisionShape BoxShape = FCollisionShape::MakeBox(m_HalfExtents);
m_Location.GetTransform(Context, QueryTransform);
// Push our query out by our half extents so we aren't centered in the box.
FQuat Rotation = QueryTransform.GetRotation();
FVector HalfExtentsOffset = Rotation.GetForwardVector() * m_HalfExtents.X;
QueryTransform *= FTransform(HalfExtentsOffset);
TArray<FOverlapResult> Results;
if (World->OverlapMultiByChannel(Results, QueryTransform.GetLocation(), QueryTransform.GetRotation(), GetCollisionChannel(), BoxShape))
{
ProcessResults(Context, Results);
}
}
#if !UE_BUILD_SHIPPING
if (FAblAbilityDebug::ShouldDrawQueries())
{
// Nope, go ahead and fire off our Async query.
FVector AlignedBox = GetAlignedBox(Context, QueryTransform);
FAblAbilityDebug::DrawBoxQuery(World, QueryTransform, AlignedBox);
}
#endif // UE_BUILD_SHIPPING
}