# Forward vector not correctly functioning?

**URL:** <https://forums.unrealengine.com/t/forward-vector-not-correctly-functioning/777034>\
**Category:** Blueprint\
**Tags:** forward-vector, unreal-engine, Blueprint, question\
**Created:** [February 23, 2023, 12:36pm UTC](https://forums.unrealengine.com/t/forward-vector-not-correctly-functioning/777034 "2023-02-23T12:36:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tijdlab](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tijdlab/32/958613_2.png) [@Tijdlab](https://forums.unrealengine.com/u/Tijdlab)\
**Post date:** [February 23, 2023, 12:36pm UTC](https://forums.unrealengine.com/t/forward-vector-not-correctly-functioning/777034/1 "2023-02-23T12:36:13Z")

</div>

Hi everyone! I’m creating a cannon and have run into some unexpected behaviour;

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/a/7faf8a3ef32c76c4e438f81d958844c8afd365b5.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/a/7faf8a3ef32c76c4e438f81d958844c8afd365b5.mp4)

The 3 cannons on the left work but the rest don’t or have a small offset. I’m using the forward vector of an arrow (which points in the direction the cannon shoots) \* by a float (speed) to shoot the cannonball along the current rotation of the cannon;

 ![shooting cannon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/4/b/a4b60d229fd4961992b33b95a7890e43be6f2d14.png)

However, this results in the weird behaviour I’ve shown in the video.

Does anybody have any pointers as to what I’m doing wrong? The arc I generate uses the same method which does work in every direction…

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 23, 2023, 12:55pm UTC](https://forums.unrealengine.com/t/forward-vector-not-correctly-functioning/777034/2 "2023-02-23T12:55:02Z")

</div>

At a glance I’d say there’s `Initial Speed` and/or `Velocity` set for the P`rojectile Movement Component` and it gets overriden with the physics call. Since you’re not rotating the actors, the initial Speed / Velocity tries to do its thing and then chaos ensues. A bit of a wild guess, though.

Can you show or explain how the projectiles work? Their hierarchy, too.

* * *

Also, must we use explicit physics call for this? Projectiles movement comp simulate it already. And pretty well, too. Do tell.

---

<div class="post-metadata">

**Author:** ![Tijdlab](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tijdlab/32/958613_2.png) [@Tijdlab](https://forums.unrealengine.com/u/Tijdlab)\
**Post date:** [February 23, 2023, 1:12pm UTC](https://forums.unrealengine.com/t/forward-vector-not-correctly-functioning/777034/3 "2023-02-23T13:12:36Z")

</div>

My projectile hierarchy as of right now looks like this:  
 ![hierarchy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/0/a/f0a2763c1136ec1a4551fd3ad549f98bd2fed3b2.png)

There’s a small bit of code in the projectile blueprint but that relates to damaging an ai (the upper left cannon shows that).

The velocity on the ProjectileMovement component is set to 0, 0, 0 because I use the ForwardVector of the cannon to shoot it in the correct direction.

And to answer your last question, I’m open to all suggestions. I don’t work with physics too often… So please do tell if you have a better alternative! 🙂

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 23, 2023, 1:13pm UTC](https://forums.unrealengine.com/t/forward-vector-not-correctly-functioning/777034/4 "2023-02-23T13:13:19Z")

</div>

> And to answer your last question, I’m open to all suggestions. I don’t work with physics too often… So please do tell if you have a better alternative!

Consider the following:

- this is my CannonBall with an exposed variable:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/d/82da3edf064a9b17eff71c1d6cf57de515940758.jpeg)

As soon as the actor is constructed, the Projectile Movement Comp gets that value.

- this is my Cannon

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/f/f/4ff53dd5a17a73e95c5b09f79536e9ce668bd1d3.jpeg)

I feed the projectile with the desired value and have the movement component do all the hard work here.

Any and all physics simulation is _disabled_ here. Essentially:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/7/8/2787874481d3f95265f1ad29201ec14cf8ad0074.png)

If you try to sim physics and have the movement comp that tries to do the same, one of the systems will give up.

---

<div class="post-metadata">

**Author:** ![Tijdlab](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tijdlab/32/958613_2.png) [@Tijdlab](https://forums.unrealengine.com/u/Tijdlab)\
**Post date:** [February 23, 2023, 1:22pm UTC](https://forums.unrealengine.com/t/forward-vector-not-correctly-functioning/777034/5 "2023-02-23T13:22:48Z")

</div>

Very insightful answer, thanks a lot!  
I’ve managed to fix it 🙂

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 23, 2023, 1:22pm UTC](https://forums.unrealengine.com/t/forward-vector-not-correctly-functioning/777034/6 "2023-02-23T13:22:52Z")

</div>

An alternative that still does not use physics could look like so:

- we rotate the projectile first:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/d/a/eda2306fa723df409c6d186f9677dffebd9a6806.png)

- and Use initial Speed

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/4/34412af71a42905aad00bc1fe9e0df20842575fe.png)

There’s no other script. The end result will be the same.

---

<div class="post-metadata">

**Author:** ![ugmoe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ugmoe](https://forums.unrealengine.com/u/ugmoe)\
**Post date:** [February 23, 2023, 1:47pm UTC](https://forums.unrealengine.com/t/forward-vector-not-correctly-functioning/777034/7 "2023-02-23T13:47:48Z")

</div>

first i would try to disable collision on the cannons, just to see if the cannon balls are colliding with the cannons on launch (physics wont work if you disable collision on the balls)

second i would try what everynone suggested above, just set the rotation of the projectile and use initial velocity,

on my project, i had to add thse 2 IgnoreActor nodes after i spawn the projectile, here CapsuleCollison is your cannon’s collision component, and Self is the cannon

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/0/7/407a5179bcdaf4e8e3c4d47c20f08039d9ac7d92.png)
