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"

How to continue projectile's movement after hitting a surface

Hi. My projectile must continue its movement after hit event at some conditions. How to relaunch it if it has stopped?

Product Version: Not Selected
Tags:
more ▼

asked Feb 09 '15 at 05:40 AM in Blueprint Scripting

avatar image

FiftyStars
250 20 19 34

avatar image Duncan Dam Feb 09 '15 at 06:03 AM

you want thing like ricochet ? if you use movement component for your projectile, it have value for you if you want bullet bounce.

avatar image FiftyStars Feb 09 '15 at 06:06 AM

Yes you are right. I know about bounce params, but in my case bullet should bounce at some angles and pierce the object at other angles

avatar image Duncan Dam Feb 09 '15 at 06:19 AM

ok, then when hit you need calculate the next velocity of your bullet then just AddImpulse with true for velocity change.

avatar image FiftyStars Feb 09 '15 at 05:11 PM

Not working. Projectile stops anyway

avatar image TJ V ♦♦ STAFF Feb 09 '15 at 07:04 PM

Hi FiftyStars,

Here is a tutorial on how to create a ricocheting line trace. Even if it can't be adapted to your projectile, it may give you some ideas.

https://wiki.unrealengine.com/Simple_Line_Trace_Ricochet

avatar image FiftyStars Feb 09 '15 at 07:19 PM

Hi, i know how to calculate trajectory. I dont understand how to re launch projectile after it was stopped by the wall

avatar image Swiftle Feb 20 '15 at 01:58 AM

Hey, I'm trying to do something similar to you and I have to ways so far but none of them are perfect.

The first one requires physics so you need to enable them on your collision component (check Simulate Physics). This allows you to add impulses and force to your object. The problem is that your object will spin around so if you use get control rotation and get forward vector it might not have the results you want. I still don't know how to fix that so if anybody has an idea I'll be really interested in hearing it.

The second solution I tried didn't involve physics. I guess that you have a Projectile Movement component in your projectile. Just get that and call set velocity. As for the value, just get the Control Rotation -> Get Forward Vector and multiply that by some float value and then plug it into set velocity.

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

7 answers: sort voted first

Hi. I've "solved" my problem by creating projectile without projectile movement component. Implementing movement is easy. Bouncing - a bit harder but still real. The best thing is that i can manually start/stop its movement.

more ▼

answered Feb 20 '15 at 07:01 AM

avatar image

FiftyStars
250 20 19 34

avatar image Osok Dec 02 '15 at 12:12 PM

Could you elaborate a bit on how you did this? Thank you.

avatar image FiftyStars Dec 02 '15 at 12:19 PM

I dont know how "good" it was, but i have just created my own projectile system. A bit of gravity, a bit of bouncing, a bit of acceleration/deceleration and some other things to make it similar to projectile movement component with a bit different behaviour

avatar image Osok Dec 02 '15 at 12:36 PM

I appreciate the answer, but I am wondering if you can expand exactly on how you came up with this solution. Im guessing each frame you add an impulse in the forward vector? How did you implement the bouncing and gravity? Thank you in advance

avatar image FiftyStars Dec 02 '15 at 09:15 PM

Yes, it is attached to tick event. Its just physics. Its hard for me to answer to you, because english is not my native =D This is simple physics + geometry

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

I've found a solution to do this in blueprints only.

1) Make actor with ProjectileMovementComponent AS VARIABLE

2) Add ProjectileMovementComponent in construction script

3) Detect hit you want to ignore - set ignores for components of both actors

4) Destroy ProjectileMovementComponent and add a new one like this:alt text

Note that ProjectileMovementComponent should have autoactivate set true for this to work smoothly

projectilereset.png (108.1 kB)
more ▼

answered Apr 21 '16 at 09:13 AM

avatar image

SaperPL
21 1 2 4

avatar image SVR33 Apr 25 '16 at 03:11 AM

This is exactly what I was looking for. Thanks.

avatar image SaperPL Apr 25 '16 at 06:10 AM

Theres another option to do this if you don't want to destroy the component, but its a bit of a hack. In cpp code i found that on hit projectile component has active component variable cleared. You can reinitialize this with setactivecomponent blueprint block. After this you only need to set the velocity to make it fly.

avatar image MrChebik Feb 25 '19 at 01:25 PM

Thank you! After I pick up the object, and then throw it out, then it falls to the ground!

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

Digging through the code, I found the following function:

 void UProjectileMovementComponent::StopSimulating(const FHitResult& HitResult)
 {
     SetUpdatedComponent(NULL);
     Velocity = FVector::ZeroVector;
     OnProjectileStop.Broadcast(HitResult);
 }

So all you have to do to restart a ProjectileMovementComponent should be to reset the UpdatedComponent and Velocity. It's probably a good idea to call Activate on the ProjectileMovementComponent as well to make sure the ProjectileMovementComponent's Tick is still enabled.

more ▼

answered May 04 '17 at 01:18 PM

avatar image

AllJonasNeeds
249 26 36 71

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

Old thread but I have another trick for anyone else who finds it:

Enable ShouldBounce but set Bounciness to zero. When the hit triggers, ShouldBounce will keep it from stopping automatically and Bounciness at zero will stop the projectile from bouncing. Then you can set the trajectory.yourself. Also, you will probably need to manually call StopSimulating.

more ▼

answered Aug 27 '17 at 12:14 PM

avatar image

Jin_VE
4.4k 32 79 42

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

Hi,

ProjectileMovementComponent has category Projectile Bounces. You should check property ‘ShouldBounce’ to continue projectile moving. In addition, you can use Bounciness parameter to control bounce direction or you can use Event Hit to update projectile moving direction. If ShouldBounce is unchecked after first hit, projectile simulation will stop.

Hope it helps!

more ▼

answered Feb 13 '15 at 03:22 PM

avatar image

Gleb.Bulgakov
1.8k 76 19 143

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

Hello,

I have done this myself, it is quite complicated to make it very good, I followed a tuturial from a youtuber called MipGames, and i think that tutarial is almost perfect. Link down bellow.

Part 1: https://www.youtube.com/watch?v=jNVEimfgvm4 Part 2: https://www.youtube.com/watch?v=rtj3k1ymiAU Part 3: https://www.youtube.com/watch?v=iEVtC2xPrr0 Part 4: https://www.youtube.com/watch?v=woQQGFWQiPY Part 5: https://www.youtube.com/watch?v=3f06RbwHU1s

more ▼

answered Apr 25 '16 at 08:09 AM

avatar image

erik321123
413 17 15 31

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

In case anyone needs different approach, the way our team did was to make a projectile overlap an obstacle. If it's supposed to bounce, change normalized vector of the projectile when OnBeginOverlap fires. If it's supposed to penetrate, just let it go. If it's supposed to be blocked, use Stop Movement Immediately.

more ▼

answered May 09 '17 at 07:31 PM

avatar image

netcop0207
81 8 13 20

(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