zoukankan      html  css  js  c++  java
  • UE4代码片断备份

    在Actor内创建一个StaticMesh

    #include "Components/StaticMeshComponent.h"
    #include "Engine/StaticMesh.h"
    auto comp1 = CreateDefaultSubobject<UStaticMeshComponent>("Cube");
    ConstructorHelpers::FObjectFinder<UStaticMesh> sm(TEXT("/Engine/BasicShapes/Cube.Cube"));
    comp1->SetStaticMesh(sm.Object);
    comp1->SetWorldScale3D(FVector(0.5));
    comp1->SetupAttachment(RootComponent);
    

    用UE宏实现委托

    https://blog.csdn.net/yangxuan0261/article/details/52097699

    1 DECLARE_DELEGATE(FTimerDelegate);
    2 #define DECLARE_DELEGATE( DelegateName ) FUNC_DECLARE_DELEGATE( DelegateName, void );
    3 #define FUNC_DECLARE_DELEGATE( DelegateName, ... ) typedef TBaseDelegate<__VA_ARGS__> DelegateName;
    相当于 TBaseDelegate FTimerDelegate

    KismetSystemLibrary

    UKismetSystemLibrary::Delay(this, HitDelayTime, FLatentActionInfo(16, 2147483647, TEXT("方法名"), this));//这个延时执行一个方法

    动态加载

    LoadObject 在 Object.h内 不用找头文件了,动态加载 GO

    设置模型碰撞

    SMC = CreateDefaultSubobject<UStaticMeshComponent>("SMC");
    ConstructorHelpers::FObjectFinder<UStaticMesh> sm(TEXT("/Game/Code/Cell/CellMs.CellMs"));//查找模型加载
    SMC->SetStaticMesh(sm.Object);
    SMC->AttachTo(RootComponent);
    SMC->CastShadow = false;
    SMC->SetCollisionProfileName(UCollisionProfile::CustomCollisionProfileName);//自定义碰撞配置文件 
    SMC->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore);//忽略所有通道
    SMC->SetCollisionObjectType(ECollisionChannel::ECC_WorldStatic);//世界静态碰撞对象
    SMC->SetCollisionResponseToChannel(ECollisionChannel::ECC_GameTraceChannel5, ECollisionResponse::ECR_Block);//使用自定义通道
    

    其他

    PlayerContorller set enable click event 启用鼠标点击事件

  • 相关阅读:
    1347: Last Digit (周期函数)
    1363: Count 101 (经典数位dp)
    1360: Good Serial Inc.(不知道是什么类型的题)
    C#winForm调用WebService的远程接口
    Web Service 的创建简单编码、发布和部署
    极致精简的webservice集成例子
    SVN使用教程总结
    C# int.Parse()与int.TryParse()
    C# 函数1 (函数的定义)
    C#中的委托和事件
  • 原文地址:https://www.cnblogs.com/mattins/p/9970422.html
Copyright © 2011-2022 走看看