コード例 #1
0
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();
}
コード例 #2
0
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;
}