本文整理汇总了C++中FVector::ToOrientationQuat方法的典型用法代码示例。如果您正苦于以下问题:C++ FVector::ToOrientationQuat方法的具体用法?C++ FVector::ToOrientationQuat怎么用?C++ FVector::ToOrientationQuat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FVector
的用法示例。
在下文中一共展示了FVector::ToOrientationQuat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalculateTargetOffset
FVector UAbilityTask_ApplyRootMotionMoveToActorForce::CalculateTargetOffset() const
{
check(TargetActor != nullptr);
const FVector TargetActorLocation = TargetActor->GetActorLocation();
FVector CalculatedTargetLocation = TargetActorLocation;
if (OffsetAlignment == ERootMotionMoveToActorTargetOffsetType::AlignFromTargetToSource)
{
if (MovementComponent)
{
FVector ToSource = MovementComponent->GetActorLocation() - TargetActorLocation;
ToSource.Z = 0.f;
CalculatedTargetLocation += ToSource.ToOrientationQuat().RotateVector(TargetLocationOffset);
}
}
else if (OffsetAlignment == ERootMotionMoveToActorTargetOffsetType::AlignToTargetForward)
{
CalculatedTargetLocation += TargetActor->GetActorQuat().RotateVector(TargetLocationOffset);
}
else if (OffsetAlignment == ERootMotionMoveToActorTargetOffsetType::AlignToWorldSpace)
{
CalculatedTargetLocation += TargetLocationOffset;
}
return CalculatedTargetLocation;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:28,代码来源:AbilityTask_ApplyRootMotionMoveToActorForce.cpp
示例2: NotifyHit
void ATP_FlyingPawn::NotifyHit(class UPrimitiveComponent* MyComp, class AActor* Other, class UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult& Hit)
{
Super::NotifyHit(MyComp, Other, OtherComp, bSelfMoved, HitLocation, HitNormal, NormalImpulse, Hit);
// Deflect along the surface when we collide.
FRotator CurrentRotation = GetActorRotation(RootComponent);
SetActorRotation(FQuat::Slerp(CurrentRotation.Quaternion(), HitNormal.ToOrientationQuat(), 0.025f));
}
示例3: Update
void AFloatingText::Update( const FVector OrientateToward )
{
// Orientate it toward the viewer
const FVector DirectionToward = ( OrientateToward - GetActorLocation() ).GetSafeNormal();
const FQuat TowardRotation = DirectionToward.ToOrientationQuat();
// @todo vreditor tweak
const float LineRadius = 0.1f;
const float FirstLineLength = 4.0f; // Default line length (note that socket scale can affect this!)
const float SecondLineLength = TextComponent->GetTextLocalSize().Y; // The second line "underlines" the text
// NOTE: The origin of the actor will be the designated target of the text
const FVector FirstLineLocation = FVector::ZeroVector;
const FQuat FirstLineRotation = FVector::ForwardVector.ToOrientationQuat();
const FVector FirstLineScale = FVector( FirstLineLength, LineRadius, LineRadius );
FirstLineComponent->SetRelativeLocation( FirstLineLocation );
FirstLineComponent->SetRelativeRotation( FirstLineRotation );
FirstLineComponent->SetRelativeScale3D( FirstLineScale );
// NOTE: The joint sphere draws at the connection point between the lines
const FVector JointLocation = FirstLineLocation + FirstLineRotation * FVector::ForwardVector * FirstLineLength;
const FVector JointScale = FVector( LineRadius );
JointSphereComponent->SetRelativeLocation( JointLocation );
JointSphereComponent->SetRelativeScale3D( JointScale );
// NOTE: The second line starts at the joint location
SecondLineComponent->SetWorldLocation( JointSphereComponent->GetComponentLocation() );
SecondLineComponent->SetWorldRotation( ( TowardRotation * -FVector::RightVector ).ToOrientationQuat() );
SecondLineComponent->SetRelativeScale3D( FVector( ( SecondLineLength / GetActorScale().X ) * GetWorld()->GetWorldSettings()->WorldToMeters / 100.0f, LineRadius, LineRadius ) );
TextComponent->SetWorldLocation( JointSphereComponent->GetComponentLocation() );
TextComponent->SetWorldRotation( ( TowardRotation * FVector::ForwardVector ).ToOrientationQuat() );
}