How to make a projectile bounce

i want to make a projectile bounce, so i’ve seen other similar questions in answerhub, i’ve also tried to replicate the settings from the projectile in the first person template take a look:

Made a minor change here: overlap pawns instead of ignore

just 1 thing i couldn’t replicate: in variable->category i couldn’t find the “projectile” category, also i couldn’t create one, i don’t know exactly what it would affect in physics,

i’ve tried shooting at a static mesh (set to block all) and a “physics blocking volume”, in both cases the projectile was ignored, i think it was ignored and not overlaped because the “on begin overlap” event was not fired.
so… what am i doing wrong?

1 Like

up

/trying to up the post because only had 3 views, and probably 2 were mine/

Try setting the collision of the projectile under “Collision Enabled” to query AND physics. At the moment, all it is doing is generating overlap events when it collides.

good point, but it still ignores the blocking volumes, actually it pushes meshs with “simulate physics” but doesn’t bounce, even when i set the mass to an giant number, it just pushes the mesh and the projectile velocity and direction aren’t changed at all, and if i try to shot things with physics off and collision presets:“block all” it just ignores the mesh.

I’ve just taken a look at the code for the projectile. It looks like this:

All you need to do to make it bounce is stop it from destroying the projectile when it successfully hits by removing the end node. Or using a “delay” node before deleting it.

You’re using a child class of the parent projectile, which isn’t giving you the functionality you want to begin with. You’re probably better off starting again and creating your own. All it needs to have is an event hit.

To adjust the force applied by the projectile when it hits you can change the impulse multiplier. Either by setting it literally or creating a variable then plugging that into it.

The adjusted code looks something like this:

A video of the bounce effect with impulse multiplier set to 5 instead of hard coded to 100.


Good luck!

P.S. The collision sphere of the projectile hasn’t been touched. It’s still set to it’s defaults, query only:

ty for trying to solve my problem, looks like you’ve put some time into it, but unfortunatelly i don’t think this will solve my problem, the “projectile” class parenting my “LaserProjectile” isn’t the one in the picture, my “projectile” class is pretty different from this one, and it’s parenting a lot of different projectiles in my project, removing the parent class and remaking the class would make a mess in my code, so i won’t take this as an option, i don’t have a problem with the projectile being destroyed after a collision, also this code in the projectile doesn’t seem like it helps making it bounce at all, it just add some impulse to push the object it hits.

my problem still is: if it hits something with “simulate physics” on it will push it and then keep moving, without any change to it’s speed or direction, else if it’s a pawn it’s destroyed -and apply some damage to the pawn-, else it just ignore the mesh, even if the mesh is set to block all.

“if it hits something with “simulate physics” on it will push it and then keep moving”

Simulation on, on the mesh or projectile?
What will keep moving your mesh or the projectile?

You’d have to post some screens of your blueprint’s code to troubleshoot further.

“simulate physics” on in the mesh (and off in the projectile): the mesh acts like it was hit by a truck and gets hardly pushed away, the projectile acts like nothing happened and keep moving forward

“simulate physics” off in the mesh (and off in the projectile): projectile and mesh ignore each other

“simulate physics” on in the projectile: a lot of weird stuff happens, i can’t even describe

about the code: there’s no code at all in this “LaserProjectile”, and in it’s parent (Projectile) there’s just a big “Event ActorBeginOverlap”, but it’s set to overlap only pawns, so there’s no code being called.

Without anything hooked up in the parent class it should behave like a standard projectile component right? Like the standard one I can test with? Sounds like the mass of your projectile and its velocity is way too high. It should still bounce off static meshes that aren’t simulating physics though.

exactly, it should act like an standard actor with a colision, static mesh and projectile component, the mass is ~~100, the velocity is 1200, but i’ve tried slowing the projectile to 100 and it still didn’t bounce, i’m not sure if the mass of the mesh is affecting something with simulate physics off.

i’ve also tried to create a new blueprint with just the components to reproduce. and same thing happened

updating: i’ve just solved the problem, apparently for some reason bounce only works when the collision component is the root component, simple setting the collision as the root component solves the problem, still it’s weird i can’t understand why it don’t works without it being root component, but ok.

2 Likes

Thanks for that. Saved me some time!

I just had this same problem. I would have never guess i had to put the static mesh the projectile component is attached on as root.
Thanks.