# Overlap vs Linetrace with tick

**URL:** <https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035>\
**Category:** Blueprint\
**Tags:** linetrace, tick, overlap, unreal-engine, question\
**Created:** [September 21, 2024, 10:49am UTC](https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035 "2024-09-21T10:49:03Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![turbotanaka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@turbotanaka](https://forums.unrealengine.com/u/turbotanaka)\
**Post date:** [September 21, 2024, 10:49am UTC](https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035/1 "2024-09-21T10:49:03Z")

</div>

I need to measure the velocity of the projectile beforehand in order to measure its impact speed.  
So, i am considering either preparing a collision for overlap detection and measuring the speed before the collision, or use a line trace in Tick and measuring by distance to target.  
I know that use ticks and adding components will have a performance impact, but which is better?

---

<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 21, 2024, 2:37pm UTC](https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035/2 "2024-09-21T14:37:56Z")

</div>

There seems to be no need for any of this. When the projectile hits, you can read its velocity this frame. What am I missing?

Or do you mean to calc the impact velocity the very moment you fire it? Account for air resistance, gun’s velocity (guns can move), gravity, etc…

---

<div class="post-metadata">

**Author:** ![turbotanaka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@turbotanaka](https://forums.unrealengine.com/u/turbotanaka)\
**Post date:** [September 22, 2024, 5:20am UTC](https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035/3 "2024-09-22T05:20:02Z")

</div>

> When the projectile hits, you can read its velocity this frame

There’s a clear difference in velocity between when it’s fired and when it hits…  
 ![Screenshot](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/8/2/682863497c0c3f59a81dacd7077aba4d2757bd87.png)

---

<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 22, 2024, 6:05am UTC](https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035/4 "2024-09-22T06:05:34Z")

</div>

In another thread you mentioned avoiding the PMC, how is the projectile moved then? You add a physics impulse / set linear velocity instead?

---

<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 22, 2024, 6:07am UTC](https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035/5 "2024-09-22T06:07:13Z")

</div>

Could you clarify what you mean, it sounds as if the projectile slowed **during** flight. I am not sure I understand the issue.

Are you saying this is **not** the case, the traverse velocity remains high and you’re getting a weird read (10% or so?!) on impact only. This is a pretty strange read - I’d lean towards a script problem here.

---

<div class="post-metadata">

**Author:** ![turbotanaka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@turbotanaka](https://forums.unrealengine.com/u/turbotanaka)\
**Post date:** [September 22, 2024, 6:20am UTC](https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035/6 "2024-09-22T06:20:23Z")

</div>

Just give it an initial velocity with Set Physics Linear Velocity.  
This is enough since it only uses physics to shoot bullets.

> it sounds as if the projectile slowed during flight.

I think the bullet just hit the wall and slowed down…

---

<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 22, 2024, 7:20am UTC](https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035/7 "2024-09-22T07:20:19Z")

</div>

And you detect that via a Hit Event? What’s irregular in this case? The surface uses a physical material?

---

<div class="post-metadata">

**Author:** ![turbotanaka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@turbotanaka](https://forums.unrealengine.com/u/turbotanaka)\
**Post date:** [September 22, 2024, 7:54am UTC](https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035/8 "2024-09-22T07:54:04Z")

</div>

Your reply suggested I could get the collision velocity from the hit event, so I tried it. Physics materials are used.

> [@Event Hit - velocity before hit](https://forums.unrealengine.com/t/event-hit-velocity-before-hit/362434/2):
>
> Hey bibiGN- The best solution would be to add a collision component that is slightly larger than the mesh and set an overlap event to trigger when it’s overlapped. You can then get the velocity during the overlap event which will be immediately followed with the hit event. Cheers

I tried to get the collision velocity with this method, but I just wanted to know which had better performance versus doing it with a line trace.  
If i don’t need either, that’s better.

---

<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 22, 2024, 8:17am UTC](https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035/9 "2024-09-22T08:17:58Z")

</div>

Hence my confusion, you should need no method - I’ve been always using Event Hit to read velocity or read it off the PMC if you use it. That’s unless you’ve run into a bug or a weird Physics Material behaviour.

Regarding the overlap **once** or trace **every frame**. No clue - feels like comapring apples to oranges. I’d rather use an overlap than tick-calculate something in every bullet, every frame. But if you have only a handful of bullet at a time, it’s probsbly fine.

The thing is that none of the above should be necessary to start with.

---

<div class="post-metadata">

**Author:** ![turbotanaka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@turbotanaka](https://forums.unrealengine.com/u/turbotanaka)\
**Post date:** [September 22, 2024, 8:41am UTC](https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035/10 "2024-09-22T08:41:30Z")

</div>

After many tries, I have not been able to measure the velocity at the time of the collision using the hit event. This is clearly the velocity that was reduced after the collision.  
The method of movement of the projectile and the initial velocity may change the results.  
So to be on the safe side, I’ll continue using overlap.

Thank you for answering my question.

---

<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:** [October 22, 2024, 8:42am UTC](https://forums.unrealengine.com/t/overlap-vs-linetrace-with-tick/2031035/11 "2024-10-22T08:42:22Z")

</div>

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