unreal component

当一件事情复杂之后就必须分而治之,所以模块化在计算机中经常见到,而在unreal中component的出现很好的诠释了这点。Actor在unreal中扮演的就像一列火车的火车头,负责和看不见摸不着的unreal底层打交道,而这列火车的功能部分就落在车厢上了,也就是component上。它们就像火车车厢一样一节节的拼在Actor上,有什么什么样的component就有了什么样的Actor

下面来介绍以下主要的component

UActorComponent

这个就是万恶的开端,它继承自UObject,是所有component的父类。以下链接是官方的继承结构。
https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Components/UActorComponent/UActorComponentHierarchy/index.html
玩家在游戏世界的所见所听所得都是上面UActorComponent的衍生类完成。一个缤纷多彩的游戏世界,一个五花八门的虚拟空间,都是一个一个component拼装起来的,我们可以看见UActorComponent有87个之多。但是不要慌,这些类都是按照一定逻辑继承的,理解了自然就知道在需要时去查找相应的类。

USceneComponent和UPrimitiveComponent

其中有一个很重要的子类就是USceneComponent,从名字你可能才出来一二,我们来看看官方api文档怎么说的吧。

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Components/USceneComponent/index.html
A SceneComponent has a transform and supports attachment, but has no rendering or collision capabilities. Useful as a ‘dummy’ component in the hierarchy to offset others.

USceneComponent是一个用于transform的附件,但是没有渲染(显示)或碰撞功能

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Components/UPrimitiveComponent/index.html
PrimitiveComponents are SceneComponents that contain or generate some sort of geometry, generally to be rendered or used as collision data. There are several subclasses for the various types of geometry, but the most common by far are the ShapeComponents (Capsule, Sphere, Box), StaticMeshComponent, and SkeletalMeshComponent. ShapeComponents generate geometry that is used for collision detection but are not rendered, while StaticMeshComponents and SkeletalMeshComponents contain pre-built geometry that is rendered, but can also be used for collision detection.

PrimitiveComponents 是包含或则生成某种几何体SceneComponments。通常备用来作渲染或者碰撞,它有各种各样的几何体子类,最常见的有ShapeComponents(形状),StaticMeshComponent(静态网格),SkeletalMeshComponent(骨骼网格)。ShapeComponents 产生几何体用于碰撞,但是不渲染,而StaticMeshComponents 和SkeletalMeshComponents 包含渲染的预制几何体,也可以用来碰撞检测

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值