# Problem with slope angles

**URL:** <https://forums.unrealengine.com/t/problem-with-slope-angles/397576>\
**Category:** Blueprint\
**Tags:** ground, unreal-engine, speed, slope, Blueprint, question\
**Created:** [July 18, 2017, 9:07am UTC](https://forums.unrealengine.com/t/problem-with-slope-angles/397576 "2017-07-18T09:07:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sagaan42](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sagaan42](https://forums.unrealengine.com/u/Sagaan42)\
**Post date:** [July 18, 2017, 9:07am UTC](https://forums.unrealengine.com/t/problem-with-slope-angles/397576/1 "2017-07-18T09:07:15Z")

</div>

Hi, thanks for passing by!  
So i’ve begun setting up blueprints in order to get quake-like acceleration when in slopes. So far, it looks like in this screenshot.

 ![192284-sans+titre.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/1/d/91d3a8e827cf9478894b5176f5864a2d96ac86d0.png)

This is on event tick, the variable speed is fed into maxwalkspeed in another blueprint.  
So far, whenever my character is on a slope, he gets boosted, whatever the direction he’s going in is. I’d like him to be boosted only while going downwards. I think my method is a bad one. Could anyone help me come up with a better idea?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [July 18, 2017, 9:29am UTC](https://forums.unrealengine.com/t/problem-with-slope-angles/397576/2 "2017-07-18T09:29:10Z")

</div>

You can make dot product with (0,0,1) and impact normal I think, to get which angle/slope you have under character feet.

---

<div class="post-metadata">

**Author:** ![TahaRizvi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TahaRizvi](https://forums.unrealengine.com/u/TahaRizvi)\
**Post date:** [July 18, 2017, 9:30am UTC](https://forums.unrealengine.com/t/problem-with-slope-angles/397576/3 "2017-07-18T09:30:49Z")

</div>

Hi,  
you will have to calculate the angle of normal vector of plane and a player character.  
in current situation, i guess, it won’t be meeting the condition, as rotation will be constant ‘0’ .

let me know if it works.

thanks

---

<div class="post-metadata">

**Author:** ![TahaRizvi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TahaRizvi](https://forums.unrealengine.com/u/TahaRizvi)\
**Post date:** [July 18, 2017, 9:31am UTC](https://forums.unrealengine.com/t/problem-with-slope-angles/397576/4 "2017-07-18T09:31:20Z")

</div>

yes , exactly !

---

<div class="post-metadata">

**Author:** ![Sagaan42](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sagaan42](https://forums.unrealengine.com/u/Sagaan42)\
**Post date:** [July 18, 2017, 1:58pm UTC](https://forums.unrealengine.com/t/problem-with-slope-angles/397576/5 "2017-07-18T13:58:03Z")

</div>

Thanks for trying to help! I know that’s what I need to do, though, the problem is I don’t know how to do that! Could you help me with that?

---

<div class="post-metadata">

**Author:** ![Sagaan42](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sagaan42](https://forums.unrealengine.com/u/Sagaan42)\
**Post date:** [July 18, 2017, 2:03pm UTC](https://forums.unrealengine.com/t/problem-with-slope-angles/397576/6 "2017-07-18T14:03:34Z")

</div>

Thanks! I’ve never done that before, I’ll try and report my results!

---

<div class="post-metadata">

**Author:** ![Sagaan42](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sagaan42](https://forums.unrealengine.com/u/Sagaan42)\
**Post date:** [July 18, 2017, 5:55pm UTC](https://forums.unrealengine.com/t/problem-with-slope-angles/397576/7 "2017-07-18T17:55:52Z")

</div>

Hey! So i tried doing that, but it doesn’t really solve my problem! I can tell if the floor is at an angle but not if the character is moving downwards or upwards, just like before!

---

<div class="post-metadata">

**Author:** ![SoloByte\_Games](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SoloByte\_Games](https://forums.unrealengine.com/u/SoloByte_Games)\
**Post date:** [February 3, 2019, 2:42am UTC](https://forums.unrealengine.com/t/problem-with-slope-angles/397576/8 "2019-02-03T02:42:13Z")

</div>

Although this is an old question, I am posting the solution I worked out.  
Basically, subtract the current player position from the last player position and normalize it. That is your movement direction. Now make a dot product between the movement direction and the world up axis (for example (0,0,1)) and this gives you a value between -1(downwards) and 1(upwards). Also works for moving sidewards on a slope which gives you something close to zero (basically not moving upwards or downwards).  
I multiply that value with 90 and feed it into a float curve for finetuning the slope factor. For example my float curve points are (time/value) -90/2, -10/1, 10/1, 45/0.5, 50/0.

 ![267355-slopefactorcalculation.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/a/b/9ab6e6028ddbfa5495dbd856e83ba5ee3487db1c.png)

 ![267357-slopcurve.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/8/7/a876baf67cc1d81f97673fad83b029216cdb6e9c.png)
