代码笔记

  1.虚幻中的类前缀你会见到U,A,F,以下就是很好的罗列其中的意义

  •  U: UObject继承过来的,例如UTexture
  •    A: AActor继承过来的,例如AGameMode
  •    F: 其他的类和结构,例如FName, FVector
  •    T:模板,例如TArray,TMap,TQueue
  •    I: 接口类,ITransaction
  •    E:枚举, ESelectionMode
  •  B: Boolean, bEnabled

  2.区分大小写!

  用宏定义来包裹C++代码

  UCLASS 来包裹类

  USTRUCT 包裹结构

  UFUNCTION 包裹功能

  UPROPERTY 包裹属性


一般的结构数据类型有

FBox,FColor,FGuid,FVariant,FVector,TBigInt,TRange


打印数据到屏幕上

#include "Engine.h"

GEngine->AddOnScreenDebugMessage(0, 5.f, FColor::Yellow, FString::FromInt(Number));

GEngine->AddOnScreenDebugMessage(0, 5.f, FColor::Yellow, FString("Hello World!!!") );


容器

TArray,TSparseArray-动态数组

TLinkedList,TDoubleLinkedList

TMap-键值对哈希表

TQueue-队列

TSet-非有序集

4.15以上版本添加一个摄像机的方法:

MyCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("MyCamera"));
MyCamera->SetupAttachment(RootComponent);


鼠标操作:
InputComponent->BindAxis("Turn", this, &AMyGiant::AddControllerYawInput);
InputComponent->BindAxis("LookUp", this, &AMyGiant::AddControllerPitchInput);
不能上下转动时,在角色蓝图里pawn里Use Controller Rotation Pitch打勾。


使用函数的蓝图
UFUNCTION(BlueprintCallable, Category = "Power")
Void A()


蓝图的self在代码里用this


FVector a =GetMesh()->GetComponentLocation();
FRotator


碰撞事件的方法Hit:
FComponentHitSignature(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
FComponentBeginOverlapSignature(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
FComponentEndOverlapSignature(UPrimitiveComponent*, OverlappedComponent, AActor*, OtherActor, UPrimitiveComponent*, OtherComp, int32, OtherBodyIndex);
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值