简体   繁体   English

如何使用附加演员到组件

[英]How to use attach actor to component

I'm trying to make a hockey game in Unreal engine and trying to make a way for the puck to attach to the players stick when the stick enters the pucks HitBox.我正在尝试在 Unreal 引擎中制作曲棍球游戏,并尝试在球杆进入冰球 HitBox 时让冰球附着在球员球杆上。 This is what I've tried but it is not working at all, (This blueprint is in the pucks event graph) pls help, new to ue4这是我尝试过的,但它根本不起作用,(此蓝图在 pucks 事件图中)请帮助,ue4 的新手

It looks like you're testing the overlap against the ThirdPersonCharacter 's collision mesh, which is just a capsule shape centred on the actor.看起来您正在测试与ThirdPersonCharacter的碰撞网格的重叠,它只是一个以演员为中心的胶囊形状。 In your BP, the OnComponentBeginOverlap event will only fire with OtherActor returning the character if the puck overlaps that capsule object.在您的 BP 中, OnComponentBeginOverlap事件将仅在圆球与该胶囊 object 重叠的情况下在OtherActor返回角色时触发。 It would seem likely to me that the hockey puck never touches it, especially if the puck is sliding around on the floor.在我看来,冰球似乎永远不会碰到它,尤其是当冰球在地板上滑动时。

You need to test against the hockey stick's own collision, for which you need to use the OverlappedComponent value and cast to the hockey stick class to test that it's a hockey stick.您需要针对曲棍球棒自身的碰撞进行测试,为此您需要使用OverlappedComponent值并投射到曲棍球棒 class 以测试它是曲棍球棒。 Or you need a separate collision mesh at the end of the hockey stick.或者您需要在曲棍球棒末端使用单独的碰撞网格。

I don't know how your ThirdPersonCharacter is constructed so it's difficult to say.我不知道您的ThirdPersonCharacter是如何构造的,所以很难说。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM