# How do I use a line trace to keep my object level while also adding force?

**URL:** <https://forums.unrealengine.com/t/how-do-i-use-a-line-trace-to-keep-my-object-level-while-also-adding-force/470132>\
**Category:** Community & Industry Discussion\
**Tags:** hover, line-trace, rotation, unreal-engine, vector, question, rinterpto\
**Created:** [August 21, 2020, 7:11pm UTC](https://forums.unrealengine.com/t/how-do-i-use-a-line-trace-to-keep-my-object-level-while-also-adding-force/470132 "2020-08-21T19:11:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Buzzcore](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Buzzcore](https://forums.unrealengine.com/u/Buzzcore)\
**Post date:** [August 21, 2020, 7:11pm UTC](https://forums.unrealengine.com/t/how-do-i-use-a-line-trace-to-keep-my-object-level-while-also-adding-force/470132/1 "2020-08-21T19:11:30Z")

</div>

I have tried for a few days without getting the results I want so I’m hoping someone with more knowledge can help.

What I am trying to do is have something hover above the ground by using a line trace as a simple spring to add force to my object. This bit works as intended.

The issue is that I also want to level my object to the ground, for this I am using the impact normal of the line trace. And creating a rotation from this and the forward vector of my object. This should work in theory, but I think the spring and the “levelling” blueprints are fighting each other. Causing my object to lag and then shake as you can see from the following video.

[[https://streamable.com/5aa2hg](https://streamable.com/5aa2hg)][1]

Here is my blueprint for levelling, I have also tried RInterp before setting rotation but that didn’t work either.

 ![310940-ywpkoa3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/a/3/8a3a78a3fe694f0b9e5c9b92ca41f5277a043fa9.png)

So, any advice would be most welcome, I have already trawled Reddit, youtube and UE4 Answers hub.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [August 22, 2020, 9:54am UTC](https://forums.unrealengine.com/t/how-do-i-use-a-line-trace-to-keep-my-object-level-while-also-adding-force/470132/2 "2020-08-22T09:54:03Z")

</div>

The code looks ok, I’m wondering if it’s how you are tick / interp.

This cube monitors the distance and angle of the object underneath it:

Tick:

 ![310982-tick.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/9/f/f9fc2d1a8ecc69fb3c7686fd0e4c6e42c81c3037.jpeg)

Height:

 ![310983-height.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/1/d31a9e046fd8bcc5776dc6005f6d78983de2c414.jpeg)

Angle:

 ![310984-rotation.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/d/8/1d816a67094b6cb84ddd65a01f0d35afcbb883d0.jpeg)

Result:

![310985-ezgifcom-optimize.gif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/c/a/3ca90473290b5ce1d56b342c4da7d8298d32ae34.gif)

---

<div class="post-metadata">

**Author:** ![Buzzcore](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Buzzcore](https://forums.unrealengine.com/u/Buzzcore)\
**Post date:** [August 22, 2020, 1:29pm UTC](https://forums.unrealengine.com/t/how-do-i-use-a-line-trace-to-keep-my-object-level-while-also-adding-force/470132/3 "2020-08-22T13:29:25Z")

</div>

Thanks! I’m still not sure what I was doing wrong but I followed your blueprints and changed the SetLocation logic to an AddForce logic, with the force vector coming from the normal of the hit. With a bit of tweaking I think it will be exactly how I want it. Here’s an example: [https://streamable.com/kmhnu5](https://streamable.com/kmhnu5)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [August 22, 2020, 1:51pm UTC](https://forums.unrealengine.com/t/how-do-i-use-a-line-trace-to-keep-my-object-level-while-also-adding-force/470132/4 "2020-08-22T13:51:05Z")

</div>

Looks great 🙂

What sort of frame rate are you getting with all that grass? ( Looks lovely )
