Overlap vs Linetrace with tick

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?

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…

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

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

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.

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…

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

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

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.

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.

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.

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