UE5学习记录part12

第15节: treasure

154 treasure: spawn pickups from breakables

treasure是items的子类

基于c++的treasure生成蓝图类



155 spawning actors: spawning treasure pickups

设置treasure的碰撞

蓝图实现



156 spawning actors from c++ : spawning our treasure dynamically in code

当使用spawnactor时,普通的参数只能生成c++类的treasure实例,但是c++类的实例没有分配网格,所以需要在c++代码中生成蓝图实例,这就需要uclass类参与

借助UClass指针类,指定资源之后,蓝图类treasure就可以作为参数传入c++代码中,让c++代码生成蓝图类treasure

设置breakable在破碎之后的胶囊体对角色无block属性



157 different types of treasure: creating an array of TSubclass of variables

基于已有蓝图类生成子类

将TSubclassOf<class ATreasure>改为使用TArray<TSubclassOf<class ATreasure>>传入子类蓝图随机生成财宝



158 different types of breakables

If you scale a static mesh and then fracture it, then the geometry collection will be created based 如果您缩放静态网格物体,然后使其破裂,那么将基于几何体集合创建

on the scale of the static mesh that you created. 在您创建的静态网格体的比例上。

That's why our other pot is much bigger. 这就是为什么我们的另一个底池要大得多。

Our geometry collection was created from a scaled up static mesh. 我们的几何体集合是从放大的静态网格体创建的。

选中想要打碎的物品-》放大到合适大小-》在fracture mode下new collection and fracture-》取消勾选show bone->基于原有的BP_Breakable生成子类蓝图-》进行配置,调整capsule radius and half height

为什么一个已经设置了fracture的GeometryCollection几何体,当武器已经设置了field力场时,武器只能打破Breakable蓝图(蓝图中有设置GemometryCollection属性变量),而不能直接打破放在游戏世界里的GeometryCollection几何体?

--有一个猜测时单纯的GeometryCollection几何体没有设置capsule或者collision,没法触发weapon的gethit事件,而weapon只有在gethit事件中才createfields。GeometryCollection几何体只有碰到fields才有解体的可能,可以设置非breakable蓝图类包含有GeometryCollection几何体变量和capsule可以触发overlao事件来验证。(已验证单独的fieldsystem蓝图类可以直接破碎一个单纯的GeometryCollection几何体)

可以使用explode amount来查看破碎的过程



159 niagara system: adding a sparkling effects to pickups

创建niagara系统

可以手动添加更多模块



160 niagara components: adding our emitter to Items

需要在build.cs文件中添加niagara模块

相关推荐
Rabitebla1 小时前
【Linux操作系统】进程篇(十一):进程程序替换——从底层原理到 exec 函数族
linux·服务器·c++·笔记·学习·算法
叼烟扛炮2 小时前
[LangChain] 学习笔记(03):打破失忆症——对话机制与上下文管理
java·前端·javascript·笔记·学习·langchain
旖旎夜光2 小时前
【C++ 基础入门】类和对象(下):初始化列表、static 成员、友元与内部类
c++·笔记·学习
LONGZHIQIN2 小时前
STM32学习笔记
笔记·stm32·学习·arm
redtank20003 小时前
纯血鸿蒙小工具三件套实测:弹幕手持、爱记录与仓库管理软件
学习·华为·智能手机·harmonyos
§ꦿCFོ༉3 小时前
嵌入式八股文—C语言入门学习(二)
c语言·学习·嵌入式·编程语言
Nerd(BUG版)3 小时前
KMP学习day5--Kotlin Flow异步流基础
开发语言·学习·kotlin
叼烟扛炮3 小时前
Linux 学习笔记(六十一):网络编程毕业设计——Reactor 反应堆模式
linux·网络·笔记·学习·课程设计
叼烟扛炮5 小时前
Linux 学习笔记(五十九):epoll 的生死抉择——LT 与 ET 模式
linux·运维·服务器·网络·笔记·学习·php
水云桐程序员12 小时前
从零开发软件的步骤,软件开发从零到完成应该怎么做?
笔记·学习·软件构建·个人开发