惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
The Register - Security
The Register - Security
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
P
Proofpoint News Feed
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
The Last Watchdog
The Last Watchdog
F
Fortinet All Blogs
S
Schneier on Security
Help Net Security
Help Net Security
Security Archives - TechRepublic
Security Archives - TechRepublic
C
Check Point Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
I
InfoQ
T
The Blog of Author Tim Ferriss
Cisco Talos Blog
Cisco Talos Blog
Stack Overflow Blog
Stack Overflow Blog
T
Troy Hunt's Blog
人人都是产品经理
人人都是产品经理
T
Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cyber Attacks, Cyber Crime and Cyber Security
雷峰网
雷峰网
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
Forbes - Security
Forbes - Security
Vercel News
Vercel News
S
Security Affairs
美团技术团队
P
Privacy & Cybersecurity Law Blog
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Spread Privacy
Spread Privacy
Attack and Defense Labs
Attack and Defense Labs
IT之家
IT之家
U
Unit 42
Recorded Future
Recorded Future
W
WeLiveSecurity
PCI Perspectives
PCI Perspectives
P
Palo Alto Networks Blog
H
Hacker News: Front Page
S
Security @ Cisco Blogs
博客园 - 【当耐特】

博客园 - 一粒沙

ue4 FString 中文乱码问题 用户中心 - 博客园 用户中心 - 博客园 [UE4]引用Grabbable接口 [UE4]Grabbable接口 [UE4]接口 [UE4]虚幻引擎的C++环境安装 [UE4]Drop,扔物品 [UE4]Grab抓取 [UE4]抓取准备 [UE4]用Format Text进行调试 [UE4]Overlap Event 碰撞事件 [UE4]Skeletal Mesh的碰撞体 [UE4]模拟物理 [UE4]Static Mesh的碰撞体 [UE4]镜像 [UE4]AttachToComponent的AttachmentRule [UE4]Add Offset [UE4]线性插值Lerp
[UE4]重构Grab和Drop
一粒沙 · 2019-03-09 · via 博客园 - 一粒沙

一、在前面的实例中是把Grab和Drop逻辑放到SimVRHand手柄对象里面,从面向对象来看,Grab和Drop逻辑应该放在被抓取的对象中,因为可能每个对象被抓取后要执行的Grab和Drop逻辑都不太一样:武器被抓取、门被抓取、抽屉被抓取的逻辑是不一样的,每个对象最清楚自己的业务逻辑。

二、新建一个名为“GrabTargetActor”的Actor,并添加一个StaticMesh,开启模拟物理,并勾选“Generate Overlap Events(产生碰撞事件)”

  

    

三、给“GrabTargetActor”添加2个函数:OnGrab(被抓取时被调用)、OnDrop(被抓取释放后被调用)。

  如果下图中的StaticMesh作为Actor的根节点,则不需要重新附加根节点,因为其本身就是跟节点。当如图中的StaticMesh不是根节点,并且开启了模拟物理,则需要手动重新附加到根节点。

  

 四、虽然GrabTargetActor中设置的静态模型是一个立方体,但是放到关卡中以后,如图所示,是可以单独修改每个GarbTargetActor实例里面的组件属性的。

  利用该特性,可以很方便的做成扩展性比较强的功能来。

  

五、Scene Component是Skeletal Mesh的父类,因此OnGrab定义的Hand为Scene Component,在调用OnGrab是可以将Skeletal Mesh类型的变量传递进来。