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 control the movement of a projectile?

I have a missile projectile that i want to control after it is spawned. Can anyone help me out?

Product Version: UE 4.16
Tags:
more ▼

asked Dec 02 '17 at 02:22 AM in Blueprint Scripting

avatar image

Nadvgia
3 1 7

avatar image Nadvgia Dec 04 '17 at 06:53 PM

I´ve added the mouse controls of a vehicle i am working on, still right after the projectile is fired, the mouse controls do not change the tragectory of it. I´m starting to think that it cannot be done and only one BP actor can be possesed at a time, can someone please correct me if i´m wrong?

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

4 answers: sort voted first

Hi,

You are correct that only 1 BP actor can be possesed at the time. However, if you are attempting to make a homing missile that will track targets without having to maunally guide it. You could simply make your missile a simple AI flying pawn. Then use a nav mesh to give it simple move to commands. Alternatively, you can use a system similar to the one used in the Turned Based Strategy template available free in the market, to use force to move your pawn across the stage without needing a navemesh or even a movement component on it. I can give you more details on either if this is what you are trying to do. If not let me know and I might be able to help you make a mouse guided missile at the cost of abandoning your default pawn while you pilot it.

more ▼

answered Dec 04 '17 at 07:51 PM

avatar image

Cross1013
31 1 3

avatar image Nadvgia Dec 05 '17 at 11:30 AM

Hey Cross1013,

Thanks for the reply, i toke a look to homing missiles tutorial but is not what i am looking for, the projectile will be "wire guided" until its collision hits something.

M9113 wiki - https://en.wikipedia.org/wiki/9M113_Konkurs

I found a video to represent my goal, is no more than this - https://www.youtube.com/watch?v=52nBtIds7xE at 0:14.

I have the same vehicle, same projectile, how to drive the projectile is the question. I think that abandoning the pawn to control of the projectile may be a good idea if there is a chance to return to the pawn after the projectile (actor) is destroyed.

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

perhaps just get the control inputs of your Pawn, then feed them as steering inputs to your projectile... this way you'd be able to control both actors simultaneously

Just launch the projectile using your desired velocity, don't set it to homing ...
In your projectile's event graph, Get Player Pawn or Get Player Controller, get the control input values (maybe pitch and yaw, I guess you are using mouse control), use these inputs in your projectile BP (multiplied by a scalar) to add to world rotation, you might need to smooth the inputs using an interp node.

more ▼

answered Dec 07 '17 at 09:29 AM

avatar image

aNorthStar
938 8 17 20

avatar image Nadvgia Dec 09 '17 at 04:33 PM

So i still trying to get this to work, ANorthStar, thank for your input. I´ve added the control nodes from my pawn, which i´ve done before and added the playercontrol node this following way:

alt text

The "Box" is a collision that i´m trying to drive, the projectile still going forward, no left or right movement is seen. Maybe i should add something in the pawn part too?

capture.png (106.3 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

... for simplicity, initially, I'd run this on Tick in your projectile... in BeginPlay just get a reference to your Player Pawn and promote to a variable... on tick, I'd get the Pitch / Yaw input axis magnitudes (assuming you are using mouse inputs), and apply them (with a scalar) to Add World Rotation of your projectile

more ▼

answered Dec 09 '17 at 04:41 PM

avatar image

aNorthStar
938 8 17 20

avatar image Nadvgia Dec 09 '17 at 05:52 PM

Quick question, is this how you reference a pawn? The variables i did so far are floats and booleans,,

alt text

I hope what i am asking won't be too much sand for my wagon.

capture1.png (110.1 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

It's ok to ask... it took me ages to get my head around getting references and casting... it seemed like witchcraft for ages... here you go. Just cast to whatever your custom player character's class is (my custom class is called PlayerCharacter.. just to clear up the possible confusion). Once you have a reference to your Player Character BP (or player controller BP) just get the mouse inputs, and in your Projectile BP, using Add World Rotation... apply to your projectile rotation...

alt text

reference.jpg (123.2 kB)
more ▼

answered Dec 09 '17 at 05:58 PM

avatar image

aNorthStar
938 8 17 20

avatar image Nadvgia Dec 10 '17 at 03:48 PM

Thanks for your input, unfortunately i still did not get the result i want using your bp. I´ve burned out regarding this question but if i ever make it working i´ll defenetly post my solution for the sake of other also looking for this. Thanks again and good day.

(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