Topdown - Getting Actor to Launch Towards Cursor

Hi, did you add a “Projectile Movement Component” to your shuriken blueprint?

Hey there, new to UE4 and just as the title says, I’m working with a topdown game trying to get the character to throw a projectile. I can get it to spawn, but I can’t get it to move towards the mouse cursor. This is what I have so far:

No i did not, I’m unaware of what that is.

Ok I added it real quick, what do I need to change as far as its properties go?

Ok awesome thank you for your help, definitely what I want so far… What I wanted to try to do was make it travel a set distance in the direction of my cursor, what would I need to do to accomplish that?

First you should add an “Collision Component” (to handle the collision for your shuriken) to your shuriken blueprint and set it to root (drag it onto the “Default Scene Root”). In your “Projectile Movement” set the “Initial Speed” to something like 1000 (the unit is centimeter per sec) and check “Should Bounce”. Then add an “On Projectile Bounce” Event to your graph. That event will be called when your shuriken collides with something and gives you a hit event.

290278-components.png

There’s a Node called “Set Life Span”. After the time runs up the actor will be destroyed. You can create a new variable “Range” and divide it by the initial speed to get the lifespan.

In your first image your adding 100 to the X when getting the spawn location. There’s a Node called “Get Forward Vector” (you can multiply this by 100 and then add that instead), so when the actor is rotating it will always spawn the shuriken in front of it. And instead of using an event tick with a gate you could use a timer. The difference is an event tick will execute every frame (when you have 60fps that will be 0.017 sec) and a timer will only called every “Time” (here 0.1 sec) especially when your project gets bigger using timer instead of an event tick will save performance.