2D Platformer Basic Shooting
I'm trying to spawn a bullet that goes the direction the player is facing at a constant speed. I can't seem to figure out anyway of doing this (I'm pretty new.) Anyone know how to do this?
asked Feb 15 '15 at 01:45 AM in Blueprint Scripting
Assuming the direction the player is facing is also the "forward" direction of the actor (it usually is), you can get the forward vector of the player's actor (search "get forward vector" in blueprint) and then multiply that by whatever speed you want the bullet to go to get a velocity vector.
If you want the bullet to just go in the same direction with the same speed, I think this is the right way to do it. Your bullet will need to be an actor with some type of movement component (I think there's a projectile movement component, but I haven't really looked into it). Realistically, any movement component will do.
Movement components have a velocity that you can set (search "set velocity"). Set that to the velocity we calculated in the previous step and you should be good! You'll want to make sure you've disabled gravity and any type of resistances in the movement component of your actor.
answered Feb 15 '15 at 01:55 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here