Mouse tracking missile

So I need to make this game where the character ( viewed in third person) can shoot rockets!
But when I shoot the rocket I want it to follow the mouse.

This is for gameplay reason interesting to guide the rocket around the map.
But I have no real clue on how to make the rocket follow my mouse?

This is my current blue print i have, but when i add the ;ast blue print my rocket doesn’t spawn anymore!
This is a snap shot from my launcher script, maybe I am working un the wrong place?

Thank you very much already for helping me!

Your spawning the projectile at the target.

You still need to spawn the projectile at the socket, and then send it to the target.

That means, probably, your projectile needs to be a BP with homing code.

So it’s quite elaborate…

No worries.

I don’t think you have time to get it to follow the mouse, but you can aim where you have clicked.

So spawn ( launch ) it from the socket, and head for where the mouse has clicked:

301459-hit.jpg

That method is ok if you’re cool with the cursor begin visible ( you can see the arrow ).

If you want to guide the missle by moving the mouse around, then the missle BP has to be some kind of pawn and projectile which you control with the mouse ( the player would not move ).

That’s quite a lot more involved.

Just to check, when you say ‘mouse cursor’, do you mean this:

301460-ezgifcom-crop.gif

or this:

301471-crosshair.jpg

I mean the actual cursor!

301460-ezgifcom-crop.gif

Yup, so then it’s like I said, that hit result under mouse cursor node.

I think you might find it easier to target with the mouse and then launch, rather than firing and then frantically trying to steer it… :slight_smile:

So I still have a problem with my tracking script ClockWork!
currently when i launch my rocket i have no means of controlling it, and i wanted to try the method you suggest:

This script is on the rocket itself, i thought i made more sense to try and control it from inside of the projectile itself.

And this is everything i have of code on the launcher:

In here i just create a rocket and check to create another one is the bool is set to false.

So the main problem is that nothing really happens, and i dont understand what the ‘Hit Result’ actully does.

Thanks again for trying to solve this issue with me, i appreciate your help very much!

So this is what i have changed, but it doesn’t seems to change a lot:

Does the projectile appear at all?

So, first things first. You don’t need the fire event in the projectile. It’s already fired when you spawn it. So just put the event fire in your launcher, and use a begin play in the missile BP.

Does it appear then?

yes yes it does :slight_smile:
it just doesn’t respond to click after the launch, i just flies straigt forward!

Yes!.. it’s working actually…Now, get rid of set actor location, and say:

302885-target.jpg

Then on Tick, say:

Sorry, EDIT, that should say:

302880-p2.jpg

its sais this:

Cool. So if you say this:

It should keep saying ‘reset’ and let you launch again?

so no this doesn’t seem to work, when i use this i can shoot 1 rocket and then i need to wait until it collides with something so it gets destroyed. So i cannot shoot multiple rockets after each other if that is what you wanted to try.

But if you only have that code, it immediately resets the bool. Do you get the print string?

yes i do get the reset print every time

So now my projectile says:

It goes where I’m holding the mouse.

Ok this works but not completely!
The rocket spawn on the exact mouse location and not from the launcher socket anymore.