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

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

博客园 - 一粒沙

ue4 FString 中文乱码问题 用户中心 - 博客园 用户中心 - 博客园 [UE4]引用Grabbable接口 [UE4]Grabbable接口 [UE4]接口 [UE4]重构Grab和Drop [UE4]虚幻引擎的C++环境安装 [UE4]Drop,扔物品 [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抓取
一粒沙 · 2019-03-07 · via 博客园 - 一粒沙

一、关键函数:AttachToCompoent,将要抓取的物品附加到角色手上,让物品跟随手移动,开起来就像是抓取在手里了。

二、取消模拟物理。在开启模拟物理的情况下,AttachToCompoent是不管用的,被抓取的物品只会受物理重力控制,抓取不起来的。

三、创建函数FindGrabTarget,使用GetOverlappingActors(可以设置值获取某一个类别的物品,也可以不设置获取所有重叠的物品)获得跟手重叠物品。

  

 三、使用IsValid判断抓取的物品是否有效,并将抓取到的物品保存到一个变量,供Drop(扔物品)函数使用。

  模拟物理不是Actor的属性,而是Actor中Mesh组件模型(包含Static Mesh和SkeetalMesh)的属性,使用Get Component By Class获取actor中Mesh组件模型,并取消模拟物理(使用Set Simulate Physics方法,Get Component By Class需要先选择Mesh Component才有该方法)。

  AttachToCompoent的Rule选择Keep World,抓取后保留被抓取的物品原来的样子(包括位置、选择角度、缩放)。  

五、没有碰撞体的物品是无法抓取起来的。如果物品有碰撞体,但是依然无法抓取起来,则要检查被抓取的物品是否没有勾选Generate Overlap Events(产生碰撞事件),勾选上这个选项就可以了。同时被抓取的物品的Mobility可移动性要设置为Movable

   

 六、可以看到方块被移动以后,原来的影子还在。原因是方块原来是Mobility = Static,因此引擎给该方块构造的是静态光照(优化性能),改成Movable以后要,要重新烘焙,游戏运行中,再次抓取并移动这个方块,就不会产生影子问题了。