# Dynamic Distance Calculation between player character and ground.

**URL:** <https://forums.unrealengine.com/t/dynamic-distance-calculation-between-player-character-and-ground/1808696>\
**Category:** Programming & Scripting\
**Tags:** distance, unreal-engine, Blueprint, question, vectors\
**Created:** [April 17, 2024, 9:23pm UTC](https://forums.unrealengine.com/t/dynamic-distance-calculation-between-player-character-and-ground/1808696 "2024-04-17T21:23:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gulkaur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gulkaur](https://forums.unrealengine.com/u/Gulkaur)\
**Post date:** [April 17, 2024, 9:23pm UTC](https://forums.unrealengine.com/t/dynamic-distance-calculation-between-player-character-and-ground/1808696/1 "2024-04-17T21:23:36Z")

</div>

I want to develop a system that displays the distance between the player character and the ground/platform. When measuring the distance between two points at different heights, the calculation should start when descending, including movements at varying heights (while descending). How can a blueprint system be constructed to calculate this?

---

<div class="post-metadata">

**Author:** ![eldany.uy](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/eldany.uy/32/821920_2.png) [@eldany.uy](https://forums.unrealengine.com/u/eldany.uy)\
**Post date:** [April 17, 2024, 10:04pm UTC](https://forums.unrealengine.com/t/dynamic-distance-calculation-between-player-character-and-ground/1808696/2 "2024-04-17T22:04:04Z")

</div>

use linetrace by channel

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/0/5/c059ef303f6b11602896796cc55b215c0ce0f257.jpeg "WTF Is? Line Trace By Channel Node in Unreal Engine 4 ( UE4 )") ](https://www.youtube.com/watch?v=yo9VrxFgUJY)

---

<div class="post-metadata">

**Author:** ![Gulkaur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gulkaur](https://forums.unrealengine.com/u/Gulkaur)\
**Post date:** [April 17, 2024, 11:25pm UTC](https://forums.unrealengine.com/t/dynamic-distance-calculation-between-player-character-and-ground/1808696/3 "2024-04-17T23:25:41Z")

</div>

So here is what I made.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/6/0/360e9e134252dee92fc247f3a4f64f42751b4e70.png)  
the problem is there is an extra 2 vectors (for Z axis) that is coming from somewhere I wasn’t able to find.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/f/a/ffa9beb1c7e08836981c13f883ccde57020337e7.png)  
Or  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/c/6/4c6db3d9ffe9fafb542458b76df1dc929ac1645d.png)  
If character is on an angled box/block/platform. I am guessing it is still related to capsule component.

---

<div class="post-metadata">

**Author:** ![Dismiss42](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dismiss42/32/924498_2.png) [@Dismiss42](https://forums.unrealengine.com/u/Dismiss42)\
**Post date:** [April 18, 2024, 2:00am UTC](https://forums.unrealengine.com/t/dynamic-distance-calculation-between-player-character-and-ground/1808696/4 "2024-04-18T02:00:40Z")

</div>

Uh. Isn’t this just a raycast? Or, just get the two transforms and subtract their position and look at the difference in the world-up axis. If you want to know falling/rising look at the players velocity in world-down. I would definitely do this in code though.

---

<div class="post-metadata">

**Author:** ![Gulkaur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gulkaur](https://forums.unrealengine.com/u/Gulkaur)\
**Post date:** [April 18, 2024, 8:21am UTC](https://forums.unrealengine.com/t/dynamic-distance-calculation-between-player-character-and-ground/1808696/5 "2024-04-18T08:21:06Z")

</div>

You are right I can do this pretty easily in C++ than blueprints. I am trying to make prototypes with blueprints since it is much easy to just put together and find the errors. Also, I want to find out their limitations. But I am sure I am close to figuring this problem.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [May 18, 2024, 8:21am UTC](https://forums.unrealengine.com/t/dynamic-distance-calculation-between-player-character-and-ground/1808696/6 "2024-05-18T08:21:28Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
