如果没有找到对焦的Actor,那就保底对焦屏幕正中心的Actor,使用获取玩家摄像机管理器(Get Player Camera Manager)-> 获取摄像机位置(Get Camera Location)当作起点,获取玩家摄像机管理器(Get Player Camera Manager)-> 获取摄像机旋转(Get Camera Rotation)-> 获取向前向量(Get Forward Vector)* 100000.0 当作终点,进...
获取玩家摄像机管理器(Get Player Camera Manager)-> 获取摄像机位置(Get Camera Location),通过寻找查看旋转(Find Look at Rotation)来取到角色位置要朝向摄像机位置的旋转角,最后将该值的Yaw部分设置给NameBoard。注意这里设置的世界旋转(Set World Rotation),而不是相对旋转(Set Relative Rotation),因为角色本身会...
TArray<FHitResult> HitResults;//检测结果合集 FVector LineStart = FollowCamera->GetComponentLocation();;//起点位置 FVector LineEnd = LineStart + FollowCamera->GetForwardVector() * 3000;//终点位置 FCollisionObjectQueryParams ObjectQueryParams;//碰撞对象查询参数 ObjectQueryParams.AddObjectTypesToQuery(ECC...
FVector location= UGameplayStatics::GetPlayerCameraManager(InWorld,0)->GetCameraLocation(); FRotator rot= UGameplayStatics::GetPlayerCameraManager(InWorld,0)->GetCameraRotation(); TArray<AActor *>arr_pp; UGameplayStatics::GetAllActorsOfClass(InWorld, APostProcessVolume::StaticClass(), arr_pp)...
const FVector CameraLocation = TopDownCameraComponent->GetComponentLocation(); const FVector NiagaraSystemLocation = LevelUpNiagaraComponent->GetComponentLocation(); const FRotator TopCameraRotation = (CameraLocation - NiagaraSystemLocation).Rotation(); //获取相机位置和离职特效的朝向 ...
voidAMyPlayerController::OnMouseLeftPressed(){FHitResult HitResult;FVector Start=PlayerCamera->GetComponentLocation();FVector End=Start+PlayerCamera->GetForwardVector()*10000;// 射线长度FCollisionQueryParams CollisionParams;if(GetWorld()->LineTraceSingleByChannel(HitResult,Start,End,ECC_Visibility,Collision...
FRotator LookAtPlayer = UKismetMathLibrary::RInterpTo(GetControlRotation(), UKismetMathLibrary::FindLookAtRotation(FollowCamera->GetComponentLocation(), LockedEnemy->GetActorLocation())/*寻找查看旋转(摄像机向锁定目标)*/, UGameplayStatics::GetWorldDeltaSeconds(GetWorld())/*获取场景差量(秒)*/, 20...
FVector EndLocation = StartLocation + PlayerCamera->GetForwardVector() * TraceDistance; //射线的结束点 ``` 3.创建一个用于存储命中结果的变量: ```cpp TArray<FHitResult> HitResults; ``` 4.调用LineTraceMultiByProfile函数进行射线追踪: ```cpp ...
ACameraActor:(内部包含CameraComponent), 控制摄像机位置、旋转和视角。 Actor的创建 创建方式: 1 从磁盘加载(Load From Disk): 用于已经在关卡中的Actor(LoadMap, 关卡流送) 2 在编辑器PIE中运行: Actor从编辑器中复制而来,并非从磁盘中加载。 3 代码生成: 调用 UWorld::SpawnActor(才会有World::OnActorSpa...
If it finds one, the starting location of the virtual camera in the virtual world will be the location of this ZEDPawn. 📌 Note : Whether the Set Floor as Origin parameter is enabled or not, the X and Y coordinates origin of the world will be replaced with the X and Y coordinates ...