# Linear Damping towards one axis?

**URL:** <https://forums.unrealengine.com/t/linear-damping-towards-one-axis/385452>\
**Category:** World Creation\
**Tags:** Constraints, unreal-engine, Physics, question\
**Created:** [February 19, 2017, 8:04pm UTC](https://forums.unrealengine.com/t/linear-damping-towards-one-axis/385452 "2017-02-19T20:04:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Takasu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Takasu](https://forums.unrealengine.com/u/Takasu)\
**Post date:** [February 19, 2017, 8:04pm UTC](https://forums.unrealengine.com/t/linear-damping-towards-one-axis/385452/1 "2017-02-19T20:04:00Z")

</div>

So I wanted a physics related object to move faster in the Y Axis, but slower on the Z Axis. Right now I’m moving it by radial impulses. It is basically pulled to where I click on with the mouse, but I really need different speeds depending on the axis, I can’t think of simple answers to this, it would be pretty easy if I could break the linear damping into vectors, but since that’s not possible, I need some light.

---

<div class="post-metadata">

**Author:** ![Chkoupinator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chkoupinator](https://forums.unrealengine.com/u/Chkoupinator)\
**Post date:** [May 13, 2019, 8:35am UTC](https://forums.unrealengine.com/t/linear-damping-towards-one-axis/385452/2 "2019-05-13T08:35:01Z")

</div>

did you get any answer to that yet? I’m curious about that and I’ve been googling for ways to do it without success so far, my main issue is that the dampling is applied to gravity which I would rather leave intact

---

<div class="post-metadata">

**Author:** ![BenVlodgi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/benvlodgi/32/1194567_2.png) [@BenVlodgi](https://forums.unrealengine.com/u/BenVlodgi)\
**Post date:** [May 16, 2019, 7:15pm UTC](https://forums.unrealengine.com/t/linear-damping-towards-one-axis/385452/3 "2019-05-16T19:15:48Z")

</div>

The code that handles LinearDamping is here  
[DyBodyCoreIntegrator.h | bodyCoreComputeUnconstrainedVelocity](https://github.com/EpicGames/UnrealEngine/blob/70bc980c6361d9a7d23f6d23ffe322a2d6ef16fb/Engine/Source/ThirdParty/PhysX3/PhysX_3.4/Source/LowLevelDynamics/src/DyBodyCoreIntegrator.h#L72)

I’ve re-written it a bit to be easier to read

```
Vector3 linearVelocity
float linearDamping
float deltaSeconds

float linearDampingTimesDeltaSeconds = linearDamping * deltaSeconds
float linearVelocityMultiplier = Max(0.0f, 1.0f - linearDampingTimesDeltaSeconds)
linearVelocity *= linearVelocityMultiplier

```

This uses a single float to reduce velocity in all directions. To solve your problem, there’s a few options.

**Solution 1** : You could apply less force when moving the object around based on the velocity direction.

**Solution 2** : For moving objects around I recommend using the [PhysicsHandle](https://api.unrealengine.com/INT/BlueprintAPI/Physics/Components/PhysicsHandle/index.html), use this instead of a impulses. After grabbing a component, you can move the target location more or less based on direction.

- [UPhysicsHandleComponent](https://api.unrealengine.com/INT/API/Runtime/Engine/PhysicsEngine/UPhysicsHandleComponent/index.html)

**Solution 3** : You can put this code into a component or actor, that runs this logic every tick (probably want it `post physics tick`). You would get the `LinearVelocity` from the physics component, run this math. Then set the new `LinearVelocity`. You would then not set the physics component’s actual linear dampening, and just set it here. The only difference, is that here we use a vector for each axis of velocity damping.

```
Vector3 linearVelocity
Vector3 linearDamping
float deltaSeconds

Vector3 linearDampingTimesDeltaSeconds = linearDamping * deltaSeconds
Vector3 linearVelocityMultiplier = Vector3(
    Max(0.0f, 1.0f - linearDampingTimesDeltaSeconds.X),
    Max(0.0f, 1.0f - linearDampingTimesDeltaSeconds.Y),
    Max(0.0f, 1.0f - linearDampingTimesDeltaSeconds.Z))
linearVelocity *= linearVelocityMultiplier

```

---

<div class="post-metadata">

**Author:** ![Chkoupinator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chkoupinator](https://forums.unrealengine.com/u/Chkoupinator)\
**Post date:** [May 16, 2019, 11:37pm UTC](https://forums.unrealengine.com/t/linear-damping-towards-one-axis/385452/4 "2019-05-16T23:37:04Z")

</div>

The main issue is that I want dampling on most of what happens to an actor but still keep gravity intact, what do you think would be the best way of doing that?

It kind of bars solution 1 and 2 unless you think I should start manually applying gravity or something

---

<div class="post-metadata">

**Author:** ![BenVlodgi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/benvlodgi/32/1194567_2.png) [@BenVlodgi](https://forums.unrealengine.com/u/BenVlodgi)\
**Post date:** [May 18, 2019, 9:49pm UTC](https://forums.unrealengine.com/t/linear-damping-towards-one-axis/385452/5 "2019-05-18T21:49:18Z")

</div>

Then I would leave damping the same, and just apply less force to an object depending on the axis.

---

<div class="post-metadata">

**Author:** ![Chkoupinator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chkoupinator](https://forums.unrealengine.com/u/Chkoupinator)\
**Post date:** [May 19, 2019, 12:16am UTC](https://forums.unrealengine.com/t/linear-damping-towards-one-axis/385452/6 "2019-05-19T00:16:03Z")

</div>

Can’t do chief, I need damping because I need my actor to slow down over time (but never slow down while falling)

---

<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:** [May 19, 2019, 3:23am UTC](https://forums.unrealengine.com/t/linear-damping-towards-one-axis/385452/7 "2019-05-19T03:23:53Z")

</div>

If physics simulating you can GetLinearVelocity and multiply that by a number between 0 amd 1 like 0.1 every tick, but only for two of the axes, and just feed the original back in when you call a SetLinearVelocity in the same function.

If not physics simulating you can do likewise but use Get Velocity and Set Velocity instead.

Not sure how clean or realistic or problematic this approach is but try it and and let me know.

Oh yeah and mult by deltatime too because you dont want framerate messing it up.

---

<div class="post-metadata">

**Author:** ![BenVlodgi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/benvlodgi/32/1194567_2.png) [@BenVlodgi](https://forums.unrealengine.com/u/BenVlodgi)\
**Post date:** [May 19, 2019, 5:53pm UTC](https://forums.unrealengine.com/t/linear-damping-towards-one-axis/385452/8 "2019-05-19T17:53:37Z")

</div>

Then Go with my **Solution #3**.  
If you want this to be a multi-purposed solution for many objects, write it into a component that you can attach to physics actors you want to have this behavior.

- Set `0` for the default `LinearDamping` float variable on the physics object, or it will get dampened twice 😃
- Set the new `LinearDamping` vector to something like `Vector3(0.5, 0.5, 0.1)` or `0` in Z if you want no air resistance.
- Have the component get all child components from its parent, and select only physics components. Store those in an array.
- On tick run the solution 3 code for each physics body that is simulating physics.

---

<div class="post-metadata">

**Author:** ![Nortksi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nortksi](https://forums.unrealengine.com/u/Nortksi)\
**Post date:** [December 4, 2024, 5:36pm UTC](https://forums.unrealengine.com/t/linear-damping-towards-one-axis/385452/9 "2024-12-04T17:36:02Z")

</div>

> [@BenVlodgi](#):
>
> bodyCoreComputeUnconstrainedVelocity

Hi from 2024! I tried exactly this but for some reason it wasn’t frame rate independent. Which parts need multiplying by delta time?

---

<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:** [July 5, 2025, 9:04pm UTC](https://forums.unrealengine.com/t/linear-damping-towards-one-axis/385452/10 "2025-07-05T21:04:28Z")

</div>

Sorry I’ve been away too long. I don’t know the answer now. Let me know if you found out!
