# Add pawn velocity to actor

**URL:** <https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341>\
**Category:** World Creation\
**Tags:** projectilemovement, projectile-movement, unreal-engine, UE4, question, Blueprint\
**Created:** [October 9, 2018, 8:35pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341 "2018-10-09T20:35:46Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![TargetCrafter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TargetCrafter](https://forums.unrealengine.com/u/TargetCrafter)\
**Post date:** [October 9, 2018, 8:35pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/1 "2018-10-09T20:35:46Z")

</div>

I’m trying to make a plane that drops a bomb, but i want the bomb to inherit its speed for the pawn (the plane) and let the projectile movement do the rest. i have not been able to get this to work. So far i’ve tried:  
Adding the pawn’s speed to the initial velocity in the actors construction script.  
Casting for the pawn to the actor to add its initial speed to the speed of the pawn.

Any other ideas to get this to work?

---

<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:** [October 9, 2018, 9:21pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/2 "2018-10-09T21:21:57Z")

</div>

First of all, a lot depends on how you move your plane. If you do it using a timeline or any other type of interpolation, it seems as if the plane were moving, but its actual velocity value is zero, because interpolation just moves your object from one point to another with every tick, and in this case referring to your plane for velocity is useless.  
  
  
If the plane is your pawn, getting velocity is not a problem.  
  
  
Next, you may actually set an actor’s velocity upon spawning, just like this:

 ![256094-spawn.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/f/6/4f6a14bc8899d90dbc997b463dbf47ccdeadb830.png)

The question is, where you get that velocity to feed into the Set Physics Linear Velocity input.  
  
  
So any additional data might be useful. What’s the plane’s function? Is it a pawn or just an actor? How is it moved?

---

<div class="post-metadata">

**Author:** ![TargetCrafter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TargetCrafter](https://forums.unrealengine.com/u/TargetCrafter)\
**Post date:** [October 10, 2018, 6:49am UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/3 "2018-10-10T06:49:01Z")

</div>

The plane is a pawn, and for it’s movement i use the following nodes like this:

Forward movement:

 ![256117-tmp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/d/f8d8b533e2806941576eebcd1784547e3484e550.png)

Rotation:

 ![256118-tmp2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/d/8/fd8afa6db9af537b455de61ec8fd2727e472a46b.png)

This system is a modified version of the flying template from UE 4.20.

---

<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:** [October 10, 2018, 3:40pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/4 "2018-10-10T15:40:27Z")

</div>

Can you do this?

 ![256152-spawn.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/e/2/9e2623073cf51fd6c88bd35a1434cdbda29ff72f.png)

But you have to adjust the spawning location so that your projectile wouldn’t spawn in the middle of your plane.

---

<div class="post-metadata">

**Author:** ![TargetCrafter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TargetCrafter](https://forums.unrealengine.com/u/TargetCrafter)\
**Post date:** [October 10, 2018, 5:06pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/5 "2018-10-10T17:06:27Z")

</div>

No, its says that my velocity is 0, 0, 0 when i do a quick print to screen of my “Self → Get velocity”. But i do have a current speed variable, is there a way to add this to the 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:** [October 10, 2018, 5:30pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/6 "2018-10-10T17:30:32Z")

</div>

How do you set the Current Speed variable? Normally you would do that by getting Velocity and getting Vector Length from that, but since your velocity is always 0,0,0, as you say, where does the Current Speed come from?  
  
  
But I believe you can use that. You can get your Plane’s Forward Vector, multiply it by your Current Speed and you will have your velocity. But that will only work correctly if your Current Speed value actually corresponds to the Plane’s Velocity.

---

<div class="post-metadata">

**Author:** ![TargetCrafter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TargetCrafter](https://forums.unrealengine.com/u/TargetCrafter)\
**Post date:** [October 10, 2018, 5:39pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/7 "2018-10-10T17:39:01Z")

</div>

This is how i set the “current forward speed” variable:

 ![256156-tmp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/b/1/9b140635e5a019eff7d5fa13af2f1d0ada3bc0bf.png)

And This is how i apply that speed to the plane:

 ![256157-tmp2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/a/d/5ad61ff7014a0f1a2e2a9f64c78762ab92717be9.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:** [October 10, 2018, 6:15pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/8 "2018-10-10T18:15:39Z")

</div>

You use Add Offset, that’s why you get 0,0,0 from velocity. But that’s fine; have you tried the thing with the Forward Vector that I suggested? That should do the trick.

---

<div class="post-metadata">

**Author:** ![TargetCrafter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TargetCrafter](https://forums.unrealengine.com/u/TargetCrafter)\
**Post date:** [October 10, 2018, 7:02pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/9 "2018-10-10T19:02:26Z")

</div>

I have tried in the following way:

 ![256159-tmp2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/7/5/d751a7b71eb0c47db0366c5be608072b1dd00a58.png)

But these are the values i’m getting when i drop a bomb:

 ![256160-tmp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/e/d/ced396f8a498f44fd08837fc5741fc748300175a.png)

From top to bottom:  
Combined vector  
Plane vector  
Bomb vector

---

<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:** [October 10, 2018, 7:54pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/10 "2018-10-10T19:54:15Z")

</div>

What I meant was something like this stuff:

 ![256177-spawn.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/9/2/f92ef228764a3a4ca5725d1b5439aa31a4b2d4a7.png)

---

<div class="post-metadata">

**Author:** ![TargetCrafter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TargetCrafter](https://forums.unrealengine.com/u/TargetCrafter)\
**Post date:** [October 10, 2018, 8:07pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/11 "2018-10-10T20:07:53Z")

</div>

Tried that system, and this is the following result:

 ![256181-tmp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/9/0/29079c9cb3f37c212368d09ef8a7b46d1d1e5d6a.png)

The bomb still drops straight down with no 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:** [October 10, 2018, 9:10pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/12 "2018-10-10T21:10:35Z")

</div>

Well I don’t know than… try figuring out why this happens. Promote your bomb to a variable and try setting its velocity manually by key after a short time after spawning. Try adding a 0.1 seconds delay before setting its velocity. If any of these works, you’ll know that the problem is not in the bomb itself. If it doesn’t work, then the bomb is the problem, and you’ll know where to dig.  
  
  
The second line you print — it’s the plane’s forward vector, right? Or is it supposed to be the bomb’s initial velocity?

---

<div class="post-metadata">

**Author:** ![TargetCrafter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TargetCrafter](https://forums.unrealengine.com/u/TargetCrafter)\
**Post date:** [October 11, 2018, 7:13am UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/13 "2018-10-11T07:13:46Z")

</div>

The second line is the bomb’s velocity when spawned.  
I’ll give all the options you’ve given a try and report back if i know more…

---

<div class="post-metadata">

**Author:** ![mightyenigma](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mightyenigma](https://forums.unrealengine.com/u/mightyenigma)\
**Post date:** [November 20, 2018, 6:32pm UTC](https://forums.unrealengine.com/t/add-pawn-velocity-to-actor/435341/14 "2018-11-20T18:32:34Z")

</div>

Does it work better if you set the velocity on BeginPlay instead of Construct?
