# Projectile not going straight

**URL:** <https://forums.unrealengine.com/t/projectile-not-going-straight/440545>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4, Blueprint, question\
**Created:** [January 3, 2019, 6:16pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545 "2019-01-03T18:16:09Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Reetro\_69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Reetro\_69](https://forums.unrealengine.com/u/Reetro_69)\
**Post date:** [January 3, 2019, 6:16pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/1 "2019-01-03T18:16:09Z")

</div>

Hello am having a problem with my projectiles not shooting straight when my character is moving. When the character is standing it goes perfecting straight but when moving the player’s momentum makes it only goes in a single direction?  
here is video showing what’s going on and my blueprint. [Bullet example - YouTube](https://www.youtube.com/watch?v=C6ikDkbNC_E&feature=youtu.be)

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [January 3, 2019, 6:29pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/2 "2019-01-03T18:29:54Z")

</div>

If you want your projectile to move along with your character, you have to add the character’s velocity to the projectile once it’s spawned. Your projectile’s velocity only has a Z component to it, I believe.

 ![264040-projectile.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/e/f/6ef21010f2b40006cbb30bbff5754c9096c9562c.png)

---

<div class="post-metadata">

**Author:** ![Reetro\_69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Reetro\_69](https://forums.unrealengine.com/u/Reetro_69)\
**Post date:** [January 3, 2019, 7:35pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/3 "2019-01-03T19:35:01Z")

</div>

That didn’t seem to do anything still have the same problem

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [January 3, 2019, 7:36pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/4 "2019-01-03T19:36:08Z")

</div>

Can you show some screenshots of the BP where you spawn the projectile? It’s too blurry in the video.

---

<div class="post-metadata">

**Author:** ![Reetro\_69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Reetro\_69](https://forums.unrealengine.com/u/Reetro_69)\
**Post date:** [January 3, 2019, 7:40pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/5 "2019-01-03T19:40:50Z")

</div>

Yep here you go

 ![264063-viewport.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/9/7e9b4f183df2fca1aaaeec4851342c4f7c13a8eb.jpeg)

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [January 3, 2019, 7:55pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/6 "2019-01-03T19:55:21Z")

</div>

I see you have some variables exposed on spawn, and some of them deal with speed. Maybe they interfere with each other. So instead of adding the character’s velocity after the spawn node, try adding it in the Bullet BP.

---

<div class="post-metadata">

**Author:** ![Reetro\_69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Reetro\_69](https://forums.unrealengine.com/u/Reetro_69)\
**Post date:** [January 3, 2019, 8:03pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/7 "2019-01-03T20:03:56Z")

</div>

still same result instead of firing up it fires up and to the left or right depending on which am moving. It seems to me the players momentum is is interfering with my projectile movement component some how.

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [January 3, 2019, 8:39pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/8 "2019-01-03T20:39:47Z")

</div>

It doesn’t fire to the left or right, it fires straight up. Relatively to the ground it stays in the same place, it just looks like it’s moving because your character and the ground move.

Does Get Player Character get the character you need? Try casting it to your character class and find out. Or just print out the characters velocity to see if it’s more than 0.

---

<div class="post-metadata">

**Author:** ![Reetro\_69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Reetro\_69](https://forums.unrealengine.com/u/Reetro_69)\
**Post date:** [January 3, 2019, 9:05pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/9 "2019-01-03T21:05:44Z")

</div>

ya I got the right character it’s velocity it greater than 0. I wonder if it’s the set physic linear velocity node I am in paper2d and do It askes for a bone name and paper2d sprites don’t have bones. There another node I can use?

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [January 3, 2019, 10:00pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/10 "2019-01-03T22:00:32Z")

</div>

It always asks for the bone name, that’s not the issue here.

Can you show the bullet BP?

---

<div class="post-metadata">

**Author:** ![Reetro\_69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Reetro\_69](https://forums.unrealengine.com/u/Reetro_69)\
**Post date:** [January 3, 2019, 10:15pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/11 "2019-01-03T22:15:10Z")

</div>

ya here it is

 ![264076-bullet-bp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/c/6/7c66807e58b5b508de4707b05acf3e92a8f2be6d.png)

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [January 4, 2019, 6:53am UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/12 "2019-01-04T06:53:44Z")

</div>

A few comments about the overall BP:

1. On Begin Play you set the Player Ref, so you don’t have to Get Player Character anymore, you can use that reference.
2. In the Damage node you have HP to Subtract pin, but you subtract the damage manually and pass the result to the Damage node, are you sure that’s how it is supposed to be?

Now to velocity: You’re setting Max Speed and Initial Speed on Begin Play with the Projectile Movement as Target. As far as I’m concerned, the projectile movement updates on Tick, so I believe it overrides the movement that Set Physics Linear Velocity.

Maybe, if you want your projectile to move with the character, you can calculate the direction prior to spawning the projectile: in the Spawn Transform Rotation, use not the pure rotation of the Arrow, but turn it by a certain amount based on the character velocity.

I’m not sure if I’m right, but I guess that using a ProjectileMovement component applies the Initial Speed to the X vector only, so additional velocity won’t work.

---

<div class="post-metadata">

**Author:** ![Reetro\_69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Reetro\_69](https://forums.unrealengine.com/u/Reetro_69)\
**Post date:** [January 4, 2019, 5:15pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/13 "2019-01-04T17:15:38Z")

</div>

So am getting some really when I use the velocity to rotate the bullet just spawns in really random locations I think may be doing some math wrong how would I rotate using the player velocity?

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [January 4, 2019, 5:41pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/14 "2019-01-04T17:41:12Z")

</div>

E.g. like this:

 ![264172-rot.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/1/e/91e3b35c8baf52a47cce8021749ff3099f46f015.png)

---

<div class="post-metadata">

**Author:** ![Reetro\_69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Reetro\_69](https://forums.unrealengine.com/u/Reetro_69)\
**Post date:** [January 4, 2019, 5:51pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/15 "2019-01-04T17:51:54Z")

</div>

ya that didn’t seem do anything still not moving with the player am kinda out of ideas at this point

---

<div class="post-metadata">

**Author:** ![mahri726](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mahri726](https://forums.unrealengine.com/u/mahri726)\
**Post date:** [August 4, 2022, 3:58pm UTC](https://forums.unrealengine.com/t/projectile-not-going-straight/440545/16 "2022-08-04T15:58:05Z")

</div>

I had the same problem. While moving the character, the projectiles were not going straight when shooting up. Fortunately, I found a solution that worked for me.

> [@How do I account for player motion when firing a projectile?](https://forums.unrealengine.com/t/how-do-i-account-for-player-motion-when-firing-a-projectile/416067/2):
>
> The problem is one of timing. To solve this, create a vector variable in the projectile called “InheritedVelocity”. In the details panel, set it to “Public” and “Expose on spawn”. Now go to where you spawn the projectiles and you will see the inherited velocity pin. Plug the pawn velocity in there. Then in your projectile, when you set the initial velocity, add in the inherited velocity. It should work fine (I’ve done it before).
