本文整理汇总了C++中USceneComponent::GetComponentRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ USceneComponent::GetComponentRotation方法的具体用法?C++ USceneComponent::GetComponentRotation怎么用?C++ USceneComponent::GetComponentRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USceneComponent
的用法示例。
在下文中一共展示了USceneComponent::GetComponentRotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetWidgetCoordSystem
FMatrix FSCSEditorViewportClient::GetWidgetCoordSystem() const
{
FMatrix Matrix = FMatrix::Identity;
if( GetWidgetCoordSystemSpace() == COORD_Local )
{
AActor* PreviewActor = GetPreviewActor();
auto BlueprintEditor = BlueprintEditorPtr.Pin();
if (PreviewActor && BlueprintEditor.IsValid())
{
TArray<FSCSEditorTreeNodePtrType> SelectedNodes = BlueprintEditor->GetSelectedSCSEditorTreeNodes();
if(SelectedNodes.Num() > 0)
{
const auto SelectedNode = SelectedNodes.Last();
USceneComponent* SceneComp = SelectedNode.IsValid() ? Cast<USceneComponent>(SelectedNode->FindComponentInstanceInActor(PreviewActor)) : NULL;
if( SceneComp )
{
TSharedPtr<ISCSEditorCustomization> Customization = BlueprintEditor->CustomizeSCSEditor(SceneComp);
FMatrix CustomTransform;
if(Customization.IsValid() && Customization->HandleGetWidgetTransform(SceneComp, CustomTransform))
{
Matrix = CustomTransform;
}
else
{
Matrix = FRotationMatrix( SceneComp->GetComponentRotation() );
}
}
}
}
}
if(!Matrix.Equals(FMatrix::Identity))
{
Matrix.RemoveScaling();
}
return Matrix;
}
示例2: GetActorRotation
void ALD35Character::OnFire()
{
if (IsInAlternateForm)
{
FVector trgPos = FindComponentByClass<UCameraComponent>()->GetComponentLocation() + GetActorRotation().RotateVector(FVector(140, 0, 0));
//DrawDebugSphere(GetWorld(), trgPos, 150, 8, FColor::Red, false, 0.5f);
TArray<FOverlapResult> res;
if (GetWorld()->OverlapMultiByChannel(res, trgPos, FQuat::Identity, ECollisionChannel::ECC_WorldDynamic, FCollisionShape::MakeSphere(150)))
{
for (auto& a : res)
{
if (a.Actor.Get() && a.Actor != this)
{
a.Actor->TakeDamage(1, FDamageEvent(), this->GetController(), this);
}
}
}
if (FMath::Rand() % 3 == 0)
{
UGameplayStatics::PlaySoundAtLocation(this, TransformSound, GetActorLocation());
}
return;
}
// try and fire a projectile
if (ProjectileClass != NULL)
{
USceneComponent* cam = FindComponentByClass<UCameraComponent>();
if (cam)
{
FRotator SpawnRotation = cam->GetComponentRotation();
FVector SpawnLocation = cam->GetComponentLocation();
TArray<UActorComponent*> childComponents = GetComponentsByTag(USceneComponent::StaticClass(), "Gun");
for (auto& b : childComponents)
{
if (auto a = Cast<USceneComponent>(b))
{
if (a->ComponentHasTag(TEXT("Gun")))
{
SpawnRotation = a->GetComponentRotation();
SpawnLocation = a->GetComponentLocation();
//UE_LOG(LogTemp, Display, TEXT("NM %s %s %s %s %s"), *a->GetName(), *cam->GetName(), *SpawnLocation.ToString(), *cam->GetComponentLocation().ToString(), *a->GetRelativeTransform().ToString());
}
}
}
UWorld* const World = GetWorld();
if (World != NULL)
{
// spawn the projectile at the muzzle
FActorSpawnParameters params;
params.Instigator = this;
World->SpawnActor<ALD35Projectile>(ProjectileClass, SpawnLocation, SpawnRotation, params);
}
}
}
// try and play the sound if specified
if (FireSound != NULL)
{
UGameplayStatics::PlaySoundAtLocation(this, ShootCrossbowSound, GetActorLocation());
}
}