Рет қаралды 2,860
Destroying projectiles on impact is cool. But sometimes you might want a different behavior. I am sure you can already guess which. For example arrows look way more realistic when they stick into targets. You are maybe thinking that it is too difficult to implement for game characters as they usually use skeletal meshes which usually have animations. Because you want an arrow to move along with the skeletal mesh part it stuck into.
But actually it is simple. We launched 100s of arrows in Unreal Engine 5.1 to figure this out.
All you need to do is to attach an arrow that hit the character to a skeletal mesh socket. The question is how exactly you can do that and what additional logic you need to make it look realistic.
Everything started with the empty (null) sweep result returned by the Begin Overlap Event. This was because I used physics to simulate arrow movement.
The Unreal snippet: dev.epicgames.com/community/s...
00:00 Intro
00:45 Initial setup
01:14 Collision setup of the arrow and character
02:34 Begin Overlap Event
03:02 Line Trace
03:28 Some conditions to make it a bit omre realistic
04:06 Attaching the arrow actor to the skeletal mesh component
04:49 Penetration depth logic
05:23 Applying damage
05:47 How to debug it using Print String and Draw Debug
06:35 Result Overview
06:53 Tribute to those who make it this far