How do I create a scatter FPS bullet mechanic

Hello, does anybody know if there’s a tutorial somewhere where I can learn how to blueprint scattering bullets, something similar to hanzo’s ability in Overwatch but with a bullet instead ()
Thanks to anybody who decided to dedicate a few words to reply

I know nothing about Hanzo but the most basic implementation would look something like this:

I was thinking more like shooting a single bullet that on contact with say a wall would split in different directions, from what I see on the pictures on your post, the scatter would start from the barrel, right?

Yeah, my Hanzo knowledge is lacking. Like this then perhaps:

Annotation-20191110-131307.jpg

yep, that’s exactly what I meant, thanks man, I appreciate it, I’m kinda wondering how I would go about adding an effect similar to this: [video]https://giphy.com/gifs/TgNvjNhR8tKhiINgUC[/video]

You will want to look deep into Projectile Movement Component.

The basic setup for this effect would look like this, you’ll need Bounce and Initial Speed.

vid: https://i.gyazo.com/fc016f7ab34fa952000c795f4a38cfee.mp4

There’s **no physics simulation **on the sphere. In the Construction Script of the projectile you set the velocity which is actually interpreted as *direction *by the above-mentioned component providing there’s a value greater than zero set as *Initial Speed *(see above). This makes it fly off in a completely random direction (which ideally should be improved with some surface normals math)

Annotation-20191110-162035.png

The spawning is pretty much the same:

The trails are done here with debug points just to visualise trajectory - look into particle - ribbon (?) I think, to do it right.

Hope this gets you started.

Thanks, man, you’ve been more than helpful, really, I appreciate you dedicating time to explain this to a complete beginner

I sort of implemented the scatter bullet in my demo, but now the bullets (spheres rather) are not really traveling on a straight line, if you look at the gif, after the first hit the bullets go straight in different directions, my spheres just fall on to the floor, I unchecked the simulate physics box on the sphere component but it didn’t fix anything. At the moment the direction of the sphere is set randomly, but I’m trying to come up with a more realistic approach, since sometimes when I shoot a wall some spheres go through it instead of bouncing off, in my demo I also have ricochet bullets, for those I’m using a mirror vector by normal node, but it just returns a direction vector, I’d need multiple mirror vectors but with a different direction for every bullet.
I made a video to show you what I mean https://imgur.com/a/jKj3Sea

Looks like you forgot to set the Projectile Gravity Scale to 0. As in the image I posted, at the very bottom here:

Annotation-20191111-153139.png

That’s what I originally meant by improving the normals. You’d need to take the normal of the hit surface and have the projectiles spawn in a cone pointed along that normal. At the moment it’s a sphere so they do go everywhere indeed.

edit:

So this should work nicely:

You can get the extra *New Direction *pin on the spawn mode by modifying the Construction Script in the projectile like so:

It’s a new vector variable that gets updated when the projectile spawns.

In addition, ensure that sphere’s collision ignores other spheres - since they all spawn in the same spot, they will bounce off each other initially a lot and lose momentum - this can be further refined by using custom collision channel if necessary, but ignoring Physics Body should do the trick:

Should work a wee bit better now:

https://i.gyazo.com/ac56f30caa988ae6…e57ca7eb4f.mp4

To make it work even better, you could also account for the firing direction so the projectiles ricochet in a cone rather than just shoot out from the surface in a perpendicular fashion. Not sure how realistic it’s supposed to be, though.

edit2: yeah, combining a mirrored vector with a bit of random scatter should get you there. Or like this:

Oh my god, it does work, apparently I’m an idiot, I didn’t check the gravity scale, thanks for explaining the projectile spawning, since we’re ignoring the physics body on the sphere though, they’re not colliding with the rest of the geometry on the scene now.

Is your entire scene physics based?

I can see in you’re gifs that the spheres are actually colliding with the rest of the geometry, how did you do that? may I ask?

the project is just the default FPS demo, apart for tinkering with the firstpersonCharacter blueprint I haven’t really touched anything

I think that some of the boxes in that scene are physics based, they can be pushed around if I remember correctly.

There is something called Object Channels and one can set up their own. Once you set them up, they show up as tickboxes in the physics settings (of the static meshes, like the sphere). They can be set up here, at the bottom:

I may not have time to look into this today or tomorrow but here’s a *really *good read:

https://forums.unrealengine.com/unre…sion-filtering

Do tell if you make progress!

Thanks man I’ll look into it right now

As an example, I created a Projectile Object Channel which is blocking by default but the spheres are Projectile Object Type and ignore Object Responses of that type:

So the projectiles can bounce off everything bar themselves:

https://i.gyazo.com/1cc09a3d16637a2b…f6b6cb36ce.mp4

Do note that you can adjust this dynamically, too - lets say 1s after spawning the bolts can block each other again if necessary for some mid-air collision shenanigans.

ok, I didn’t see you’re last reply and after I did some changes I thought I fixed it but now, I’m not so sure, I just set the collision preset to block all

here’s a video I made Imgur: The magic of the Internet

For as long as you’re happy with the way it works, it’s fine. If you ever notice it being inconsistent, the most likely culprit are the projectiles colliding against each other early on. You can then play with the collision channels to fix it up.

Good luck with the rest.