Need help with simple thing (ball movement in direction of actor)

I am not sure why this is really so difficult, but I am having trouble accomplishing it. All I need to do is at the click of a button is to shoot an object forward in front of actor. I’ve tried to go over alot of tutorials, but most of them are for more complicated tasks so this part is kind of skimmed over. I’ve tried so many things that you think would work, but when I spawn an object infront of an actor it seems like I can’t get anything to move it. I’ve wasted so much time with this simple task. Like I said I’ve watched about a dozen tutorials, and I understand spawning objects and vector locations, I just can’t get the velocity part to work. Please help! Thanks!

Did you add the object as a projectile and add the projectilemovement component.

example of a projectile:


else add some pics of your BP’s and object setup so we can see where u going wrong

Hey, I had a similar problem, and I followed the advice here…

Scroll down to Pino’s answer… I copied that, and it worked for me!

Hey fallen and Calamity. Yes FallenHere of course I’ve tried using a projectile movement component. I really don’t want to give the impression that I’ve haven’t watched many videos and read alot. I am spawning the bullet object in my 3rd person bp/fps person blueprint, and suddenly and movement is gone, and I can’t for the life of me give it back any movement it had before. Calamity, I’ve looked at Pino’s blueprint, it is just set up in such a different way that I don’t really know what to do to incorporate it. For example, at the begingin, it starts with a direction, regarding which I have no context to go by. I would put my BP but I’ve tried so many scenereos I’ve trashed and restarted so many times that honestly I wouldn’t even know what to try to show show you. I don’t know why its so difficult. user clicks spawn the bullet in front of the actor and have it speed down the players x direction. This should be a breeze. I don’t know if I have to make a donation to Epic Games or something for them to weigh in on this, because much more complex problems have been weighed in on, but this much simpler issue is just ignored. Honestly I am in a postal/angry mood. I don’t know what to do honestly. Its laughable that I can’t just add velocity to a spawned bullet actor and give it a velocity in the direction of the player on its X axis. I am sorry I sound so angry, its just this is the third day I’ve been working on this small stupidly easy task.

Is your projectile maybe colliding with your character mesh, are you using a socket to spawn the projectile at, if so move it out more in front of the mesh

Hey! I can understand your frustration… I was confused as hell by blueprint communication for about two weeks until somebody helped me out :smiley:

The Direction is a variable that is defined on the ball that you are trying to move! - You need to define two variables on the ball/object that you want to move - Speed (float) and Direction (vector).

In my system, on the 3rd person player character blueprint, I do a sphere trace when I hit the Interact key, if this trace hits the ball that I’m trying to move, I do a cast to verify that it is the ball. If it’s true, then I use the reference to set a variable called Direction. See below:

Then, on the ball, I have a clone of Pino’s script:

This takes the values of Direction and Speed, and uses it to move the ball. If the player tries to interact with it using the first script, the trace takes place, finds the ball, and using the cast, gets a reference, and sets the value of direction. The ball then uses this new direction value, and thus moves in whichever direction the player character is facing.

In your case, you could do the following…

On the first script, BEFORE the casting, spawn the ball in front of the player (again, use the forward vector to get a location), and THEN, after the spawn is completed, perform the trace.

This is probably a really crude, terrible way to make it work… but it should work!

Hey Calamity_Jones thanks for showing me your code. Its complicated, though I understand what you are doing. The thing that is a bit discouraging at this point is that if it takes that much blueprinting to do a simple task, then I’ll probably fail down the line for a project I have been working on. I was always under the impression that blueprints could do something like, in this fake code, fire_button->SetVelocity(new(bullet), speed, vectordirection(player)); or something similar to that with relative ease. But oh well it is what it is. I hate going back to unity and code, but I suppose this Engine is not for the simple minded folk like me! Anyway thanks guys, this has really helped and given me guidance!