# How to make a boundary that slows the player down to a stop?

**URL:** <https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [September 25, 2018, 6:18pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485 "2018-09-25T18:18:02Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![RyanTGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyanTGames](https://forums.unrealengine.com/u/RyanTGames)\
**Post date:** [September 25, 2018, 6:18pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/1 "2018-09-25T18:18:02Z")

</div>

I want to stop my player but not immediately. My player can fly and I am trying to put a ceiling on how high the player can fly but I want it to be a gradual stop rather than immediate. Anyone got ideas? Ive already tried applying force in the opposite direction but it makes the player go slightly up and down repeatedly rather than stop at a certain height.

---

<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:** [September 25, 2018, 7:34pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/2 "2018-09-25T19:34:31Z")

</div>

> My player can fly

The precise method would depend on how you’re moving the pawn.

Check the distance to the ground / ground plane and _[map range](http://api.unrealengine.com/INT/BlueprintAPI/Math/Float/MapRangeClamped/index.html)_ this value onto the player’s ability to gain Z. Engage this rubber band only once the player has reached a predetermined altitude.

* * *

If you find the above bit unclear, consider showing your climbing script - this would make it easier to suggest something more tangible.

---

<div class="post-metadata">

**Author:** ![RyanTGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyanTGames](https://forums.unrealengine.com/u/RyanTGames)\
**Post date:** [September 25, 2018, 7:54pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/3 "2018-09-25T19:54:18Z")

</div>

doesnt that method bring the player to an immediate stop? fyi my character uses add force to fly

---

<div class="post-metadata">

**Author:** ![RyanTGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyanTGames](https://forums.unrealengine.com/u/RyanTGames)\
**Post date:** [September 25, 2018, 7:59pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/4 "2018-09-25T19:59:30Z")

</div>

right now the method i have in mind is to apply force in the opposite direction and when velocity = 0 set z to current height until the flying button is released. any better solution than this?

---

<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:** [September 25, 2018, 8:13pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/5 "2018-09-25T20:13:16Z")

</div>

You could, above that height, Make it so that all the parts of the code that Add Force to your flying pawn cannot add any more in the positive Z direction (break the vector, overwrite the Z with negative of the difference between the height of the pawn and the ceiling height, but keep the other vectors the same, before it goes into any AddForce node).

---

<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:** [September 25, 2018, 8:20pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/6 "2018-09-25T20:20:01Z")

</div>

> doesnt that method bring the player to  
> an immediate stop?

No, the result of the map range node would reduce the climb speed gradually.

So how do you do it, you get forward vector and apply force?

---

<div class="post-metadata">

**Author:** ![RyanTGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyanTGames](https://forums.unrealengine.com/u/RyanTGames)\
**Post date:** [September 25, 2018, 8:31pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/7 "2018-09-25T20:31:25Z")

</div>

I think ive tried that method before and I end up with yo yo up and down effect as the code is trying set player at the correct height. I’m gonna try if my previous idea works.

---

<div class="post-metadata">

**Author:** ![RyanTGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyanTGames](https://forums.unrealengine.com/u/RyanTGames)\
**Post date:** [September 25, 2018, 8:37pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/8 "2018-09-25T20:37:17Z")

</div>

I apply force to +z. I tried map range and it doesnt graduate ease in etc. I thought at first that node could work but that only works on certain things like moving a character and reducing the scale value on the axis. Have I made a bad design decision using apply force instead of using the flying movement?

---

<div class="post-metadata">

**Author:** ![RyanTGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyanTGames](https://forums.unrealengine.com/u/RyanTGames)\
**Post date:** [September 25, 2018, 8:41pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/9 "2018-09-25T20:41:13Z")

</div>

I have the option of using my hacky method or redesigning the flying mechanic. I guess I’ll see if my hacky method works first.

---

<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:** [September 25, 2018, 8:46pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/10 "2018-09-25T20:46:11Z")

</div>

In that case then above a certain height then do like I said, but zero out the Z component of the force, and instead InterpTo on the Z location until it matches the height, leaving the other locations components the same.

---

<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:** [September 25, 2018, 8:47pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/11 "2018-09-25T20:47:09Z")

</div>

> Have I made a bad design decision  
> using apply force instead of using the  
> flying movement?

Not necessarily, if you want physics based movement, that’s the way to go. I’ll have a look at it if I find some spare time.

Have you tried physics thruster for movement? They’re equally difficult to balance right :]

---

<div class="post-metadata">

**Author:** ![RyanTGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyanTGames](https://forums.unrealengine.com/u/RyanTGames)\
**Post date:** [September 25, 2018, 8:55pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/12 "2018-09-25T20:55:18Z")

</div>

i think the way ive went is correct because if i try to use flying movement, i will need to use friction to slow down and that will apply in all directions which will mess up my game. I’m just gonna go with my hacky method, should be fine.

---

<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:** [September 25, 2018, 9:08pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/13 "2018-09-25T21:08:29Z")

</div>

Another idea is to use the set linear velocity node, but keep the X and Y components the same as the current linear velocity, just set the Z to 0 unless the pawn is moving downward.

---

<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:** [September 25, 2018, 9:45pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/14 "2018-09-25T21:45:40Z")

</div>

This is what I meant originally:

 ![254714-damp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/c/e/bce11cdbdbf9cefb85fd521d04159e276250cff6.png)

[![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/f/c/0fca27b4e4eb4421c11b9d57e57762acfd11565f.gif)](https://gyazo.com/caa5c24c663d0704104ccfeeafd85abb)

* * *

With this, if I just hold U, the ship will hover at max altitude. This can be improved, surely.  
Let me know if you run into any snags, it was put together rather hastily :]

edit: don’t know how I managed to spell _climb_ with a p, I’d like to blame fat fingers but that’s a stretch…

morning edit2: forgot to clarify; this dampener kicks in at altitude between 1500-2000 and gradually reduces your ability to gain Z by multiplying it by the desired/current traverse vector’s component. You could, of course, tighten it and tweak the settings a bit. Perhaps it will at least give you an alternative in case you can’t get your method to work.

---

<div class="post-metadata">

**Author:** ![RyanTGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyanTGames](https://forums.unrealengine.com/u/RyanTGames)\
**Post date:** [September 26, 2018, 12:26am UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/15 "2018-09-26T00:26:48Z")

</div>

yeah i’ll set the velocity to 0 when it reaches 0. I was gona set location to current location but setting velocity is simpler. thanks.

---

<div class="post-metadata">

**Author:** ![RyanTGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyanTGames](https://forums.unrealengine.com/u/RyanTGames)\
**Post date:** [September 26, 2018, 2:39pm UTC](https://forums.unrealengine.com/t/how-to-make-a-boundary-that-slows-the-player-down-to-a-stop/434485/16 "2018-09-26T14:39:58Z")

</div>

I see what you did there. I did something similar which was when reaching certain height in map range, the map range then dials down the force directly, so when for example when z 1000-1500 set force to current force - 0. Much simpler. I didnt like this method until I figured out I could stick velocity at 0 when velocity = 0 so that it doesnt yo yo. Then when flying button is release, velocity is released. This time though, im gonna apply force in the opposite direction rather than mess with my players flying force
