UE4 将 actor(或其组件)附加到另一个 actor(或其组件)

发布于 2025-01-19 10:39:01 字数 699 浏览 1 评论 0原文

所以,我的设置很简单。我正在制作一个 VR 飞镖游戏,使用默认的 VR 模板,我有一个 DartActor,带有用于飞镖的附加 ConeMesh (StaticMeshComponent),以及一个带有用于飞镖的附加 CylinderMesh (StaticMeshComponent) 的 TableActor。飞镖板,以及 RotatingMovementComponent。

当我检测到两者之间有重叠时,我会关闭飞镖上的物理特性(因为否则它只会弹开)并尝试将其附加到桌面演员上。我尝试过以下操作:

  • “将演员附加到演员”,当我尝试将飞镖演员附加到表演员时
  • “将演员附加到组件”,当我尝试将飞镖演员附加到TableActor的网格组件
  • “将组件附加到组件”时,当我尝试将 DartActor 的根组件或网格组件附加到 TableActor 的网格组件或根组件时。

这些都不适合我。

但不管这一点,当成功检测到覆盖物时关闭 DartActor 上的物理功能会伪造飞镖粘在桌子上。有一个小警告 - 当飞镖看似卡在飞镖中时,飞镖下方的飞镖仍在旋转。

我使用“捕捉到目标”来进行位置和旋转,并保持“保持相对”以在“附加”蓝图节点上进行缩放。

我想要的是,飞镖实际上粘在桌子上,焊接,并与桌子(飞镖板)一起旋转,同时它也在旋转。

那么,我该怎么做呢?

我使用的是 UE4.27.2,如果您需要蓝图屏幕截图,请告诉我。

So, the setup i have is simple. I'm making a VR darts game, sortof, using the default VR template, and i have a DartActor, with an attached ConeMesh (StaticMeshComponent) used for the dart, as well as a TableActor with an attached CylinderMesh (StaticMeshComponent) used for the dart board, as well as a RotatingMovementComponent.

When I detect an overlay between the two, I turn off physics on the dart (because otherwise it just bounces off) and try to attach it to the table actor. I have tried the following:

  • "attach actor to actor", when I try to attach the dart actor to table actor
  • "attach actor to component", when I try to attach the dart actor to TableActor's mesh component
  • "attach component to component", when I try to attach the DartActor's root component or mesh component to TableActor's mesh component or root component.

Neither of those worked well for me.

But disregarding that, turning off physics on the DartActor when an overlay is detected successfully fakes the dart sticking in the table. With one minor caveat - when the dart is seemingly stuck in the board, the board is still spinning underneath the dart.

I used the "Snap to Target" for both the location and rotation, and just kept "keep relative" for scaling on the "Attach" blueprint node.

What I'd like to have is, the dart actually sticking to the table, welding, and rotating with the table (dart board) while it's also rotating.

So, how do I do that?

I'm using UE4.27.2, if you need the blueprint screenshots just lemme know.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

金兰素衣 2025-01-26 10:39:01

好的,我修复了它。

事实证明,这是其他MISC滑动的组合...

  1. 静态messponent是root组件而不是默认的rootcomponent所需的静态组件 - 对于dartactor和tableactor,
  2. 我都使用了the actactActortOcontongons在dartactor的blueprint,使用dartactortocontorm DARTACTOR的self并将其附加到tableactor的staticmeshcomponent
  3. 的staticmeshcomponent中
  4. 中 在附加之前,将“模拟物理”设置为“在飞镖本身”上关闭。

就是这样,飞镖现在粘在板上并与旋转板一起旋转。

Ok, I fixed it.

It turns out it was a combo of other misc slipups...

  1. The StaticMeshComponent needed to be the root component instead of the default RootComponent - for both the DartActor and TableActor
  2. I used AttachActorToComponent in the DartActor's Blueprint, using the DartActor's self and attaching to the TableActor's StaticMeshComponent
  3. In the actual AttachActorToComponent BP node, I used "Keep World" for all three things (location/rotation/scale)
  4. I kept the "Set simulate physics" to OFF on the DartActor itself, before attaching.

And that's it, the darts are now sticking to the board and rotating along with the rotating board.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文