跟着官网学UE4(提取干货)|跟着官网学UE4(提取干货) Blueprint 3rd Person Game 21 - Add Physics Components for Punching

给拳击动作添加物理碰撞
首先需要添加两个碰撞器给左右手 进入CharacterBP 点击AddComponent 添加 两个sphere collision 调整他们打大小位置与左右手大致一致


跟着官网学UE4(提取干货)|跟着官网学UE4(提取干货) Blueprint 3rd Person Game 21 - Add Physics Components for Punching
文章图片
进入蓝图的Construction 视图 将collision绑定到左右手的骨骼位置上 这样播放动作的时候 碰撞器也会随着左右手移动
LeftHandCollision RightHandCollision Mesh在左侧的变量Component中查找或者直接从Components视图中拖拽下来
AttachToComponent中设置附着的socket为骨骼名称hand_l hand_r


跟着官网学UE4(提取干货)|跟着官网学UE4(提取干货) Blueprint 3rd Person Game 21 - Add Physics Components for Punching
文章图片
进入蓝图的EventGraph视图中 当鼠标按下 设置isPunching时 启用Collision 鼠标松开时 关闭collision
【跟着官网学UE4(提取干货)|跟着官网学UE4(提取干货) Blueprint 3rd Person Game 21 - Add Physics Components for Punching】

跟着官网学UE4(提取干货)|跟着官网学UE4(提取干货) Blueprint 3rd Person Game 21 - Add Physics Components for Punching
文章图片
场景中从start_content中拖拽一个shape 到场景中 并设置他的Simulate Physics属性为true(不设置的话只有阻挡效果面没有击飞效果)


跟着官网学UE4(提取干货)|跟着官网学UE4(提取干货) Blueprint 3rd Person Game 21 - Add Physics Components for Punching
文章图片
运行 当拳头集中立方体时 击飞

    推荐阅读