• UE4 4.25 体积检测 笔记


    创建组件
    public:

    InteractiveComponent = CreateDefaultSubobject<UInteractiveComponent>(FName("InteractiveComponent")); InteractiveComponent->InteractiveRadius = 150;

    头文件 

    #include "Kismet/KismetSystemLibrary.h"

    源文件

    //交互组件 生成检测函数
    void
    UInteractiveComponent::SpawnVolumeDetection() { //开始位置 结束位置 FVector StartLocation = this->GetOwner()->GetActorLocation(); FVector EndLocation = this->GetOwner()->GetActorLocation()+FVector(0,0,10);
      //忽略数组 TArray
    <AActor*> IgnoreSelfArray; IgnoreSelfArray.Add(this->GetOwner());

      //体积检测返回 TArray
    <FHitResult> HitResult;
      //球体检测 UKismetSystemLibrary::SphereTraceMulti(
    this, StartLocation, EndLocation, InteractiveRadius, //半径 ETraceTypeQuery::TraceTypeQuery1, //不知道枚举 false, //复杂检测 IgnoreSelfArray, //忽略数组 EDrawDebugTrace::ForOneFrame, //一帧 HitResult, //返回结果数组 true, //忽略自身 FLinearColor::Red, //显示红 FLinearColor::Green, //显示蓝 5.0f //显示时间 ); }

     

     

     
  • 相关阅读:
    CSS介绍
    docker入门
    nginx+uWSGI+django+virtualenv+supervisor发布web服务器
    niginx入门
    常用服务安装部署
    VIM
    linux基本命令
    linux目录分级
    OpenStack共享组件
    kvm认识和安装
  • 原文地址:https://www.cnblogs.com/max404/p/14263758.html
Copyright © 2020-2023  润新知