x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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 ProjectileCollision

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, Movement component

preset

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?

Product Version: UE 4.13
Tags:
preset.png (400.6 kB)
more ▼

asked Nov 08 '16 at 02:32 AM in Blueprint Scripting

avatar image

veccher
1.1k 31 17 66

avatar image veccher Nov 09 '16 at 08:39 PM

up

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

more ▼

answered Nov 16 '16 at 07:58 PM

avatar image

veccher
1.1k 31 17 66

avatar image Nobodikilla Jan 25 '19 at 03:56 PM

Thanks for that. Saved me some time!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Nov 09 '16 at 08:58 PM

avatar image

Grant Margison
86 7 14 21

avatar image veccher Nov 09 '16 at 09:26 PM

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.

avatar image Grant Margison Nov 09 '16 at 10:52 PM

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. https://www.youtube.com/watch?v=Mqjf6toHZpg

Good luck!

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

avatar image veccher Nov 10 '16 at 12:27 AM

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.

avatar image Grant Margison Nov 10 '16 at 12:48 AM

"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.

avatar image veccher Nov 10 '16 at 01:54 PM

"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.

avatar image Grant Margison Nov 10 '16 at 05:38 PM

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.

avatar image veccher Nov 10 '16 at 09:25 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question