虚幻4 贴花
来源:互联网 发布:交换机上联端口配置 编辑:程序博客网 时间:2024/04/29 21:02
class UDecalComponent* CursorToWorld; // Create a decal in the world to show the cursor's location CursorToWorld = CreateDefaultSubobject<UDecalComponent>("CursorToWorld"); CursorToWorld->SetupAttachment(RootComponent); static ConstructorHelpers::FObjectFinder<UMaterial> DecalMaterialAsset(TEXT("Material'/Game/TopDownCPP/Blueprints/M_Cursor_Decal.M_Cursor_Decal'")); if (DecalMaterialAsset.Succeeded()) { CursorToWorld->SetDecalMaterial(DecalMaterialAsset.Object); } CursorToWorld->DecalSize = FVector(16.0f, 32.0f, 32.0f); CursorToWorld->SetRelativeRotation(FRotator(90.0f, 0.0f, 0.0f).Quaternion());
根据引擎自带的topdown例子。
上面设置了贴花的材质,下面tick去更改贴花的位置
void ATestFireLightCharacter::Tick(float DeltaSeconds){if (CursorToWorld != nullptr){if (UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled()){if (UWorld* World = GetWorld()){FHitResult HitResult;FCollisionQueryParams Params;FVector StartLocation = TopDownCameraComponent->GetComponentLocation();FVector EndLocation = TopDownCameraComponent->GetComponentRotation().Vector() * 2000.0f;Params.AddIgnoredActor(this);World->LineTraceSingleByChannel(HitResult, StartLocation, EndLocation, ECC_Visibility, Params);FQuat SurfaceRotation = HitResult.ImpactNormal.ToOrientationRotator().Quaternion();CursorToWorld->SetWorldLocationAndRotation(HitResult.Location, SurfaceRotation);}}else if (APlayerController* PC = Cast<APlayerController>(GetController())){FHitResult TraceHitResult;PC->GetHitResultUnderCursor(ECC_Visibility, true, TraceHitResult);FVector CursorFV = TraceHitResult.ImpactNormal;FRotator CursorR = CursorFV.Rotation();CursorToWorld->SetWorldLocation(TraceHitResult.Location);CursorToWorld->SetWorldRotation(CursorR);}}}
0 0
- 虚幻4 贴花
- 贴花
- 虚幻4引擎
- 虚幻4引擎
- 虚幻4的Style
- 虚幻4 Editor 编程
- 虚幻4 蒙太奇
- 虚幻4编码规范
- 虚幻4目录结构
- 虚幻4 反射
- 虚幻4 材质基础
- 虚幻4 Function Library
- 虚幻4 碰撞过滤
- 虚幻4 Task小记
- 虚幻4 TaskGraph小记
- 虚幻4 笔记
- 虚幻4编码规范
- 虚幻4 SCOPE_CYCLE_COUNTER
- db2audit 审计 (适用于db2 9.7)
- 学习记录2016年10月13日 16:54:07
- unity5 assetbundle 发布资源平台的大坑。程序发布成exe后执行与编译器内不同的问题解决。
- fresco(最牛逼的图片缓存加载框架),包括xutil的使用
- Snackbar
- 虚幻4 贴花
- Ubuntu------挂载分区
- Beginning
- TextView
- Google官方架构MVP解析与实战
- Opencv调整运行窗口图片的大小
- socket error: [Errno 10061]
- 使用Maven构建多模块项目
- hdu ---2034做题笔记(c++)