Sphere Trace or Collision Shpere: Which one is better for high speed projectile?

I’m working at what is basically a frisbee project, I’m using a projectile and, for collision detection, I went the Sphere Trace route updated on Delta time. The surrounding geometry has no collision boxes so impacts are calculated on just that.

It works fine with speeds up to 1500-2000 but beyond that the projectile just goes through the geometry.

Cycling the Sphere Trace updates on Tick gives better results with speeds up to 3000-4000 but beyond that it becomes unreliable again.

What should be the proper, reliable collision detection implementation for a projectile the radius of 32 units?

Hey Judicator!

So I don’t know about the frisbee, but I know that when using bullets or other similarly VERY fast things, you want to (on TICK) grab current location, do a line trace to “Old Location” (last tick), see if there was a collision that WOULD have happened, and act accordingly. Then at the end of tick, SET “CurrentLocation” to “OldLocation” so the trace can be called next frame. This also is how a lot of fast moving weapons are implemented in melee games, like Chivalry 2 (where I got the melee code, but that was a long long time ago).

I know that’s not a solution, but I’m hoping it could give you some ideas!

1 Like

I have projectiles using PMC with speeds up to 990m/s (99000). I’ve used sphere collisions (root) with a 0.5cm radius. They work fine for the most part. Under heavy load there’s been misses.

The fix was to shift to using a capsule collision scaled so that it was a bit longer than the projectile mesh. Rotation Follows Velocity is enabled as well.

You guys gave me something to tinker with.
@Mind-Brain: I’m going to try the double check on the sphere trace’s impacts first because it’s what I’m already using for collision detection. I could store the projectile’s location and on the next tick do a trace to the previous location, this way I would just add another variable and some simple logic.

@Rev0verDrive: That’s an insane speed, yesterday, while I was checking my blueprints, I realized that I was already using a capsule trace with some logic to extend it, not by much: just 12 units forward and back the projectile, I’m going to try this next because I use that for my bounce trajectory logic so it’s going to need some more work to test it.

Out of curiosity: I used the trace instead of a collision component because I felt like it was less compute-hungry, is that so?

Collision component should be more performant In this regard.

I went the route of the double trace and I’ve reached a point where collision can be detected consistently for speeds up to 10000-15000.
At 20000 is starts to fail again, not as badly as before but bad enough to be unreliable.

I basically kept my collision detection code but branched the result based on the hit: if TRUE the collision is detected and the trajectory is calculated normally.
If FALSE, so no collision at all, another trace is started to the previous location and on hit the same logic is used again to calculate the new trajectory, then the location is stored for the next cycle.

I I’m going to test what RedOverDrive suggested but it needs some redesign of what I’m using now, while I was in the process of tinkering and testing a few bugs came out and I need to address those first.

In the meantime thank both you guys.

I’m experimenting with the collision sphere and I’m honestly baffled at how unreliable the hit detection are.

I mean: Unreal Engine is a beautiful piece of technology, a multi million dollar software: how is it possible that there’s such inconsistency in something as basic as this?

Every time I run the project I always get different result with hits, the weird thing is that usually the first three aren’t detected but after those ones it they somehow get, and, after the first hit is detected then my bouncing logic based in the same projectile usually works.

I’m clueless.

Sim Time is important here. This needs to be based on your max shot distance and the velocity. Distance / Speed = Time

These will give you a better understanding of how projectiles work.

Thanks man, I’m going to study that as soon as I have a few spare minutes available.

I’ve read about one of those nodes, never tried them tho.
What I really feel there’s a painful lack of is a knowledge base with parameters, guidelines, informations on how things work and should be used.

Long time no see.

TLDR:
I’ve been working on and off to this project mainly because of IRL stuff and a much frustration being unable to sort out the hit detection problem but this time I think I got it.

Well a few days ago I started even another redesign of the logic and I think this time I got something that works (decently).
I was still working on a variation of the sphere trace with another additional line trace check to the previous position, all the above on Tick.

On that Nth attempt at troubleshooting it occurred to me that there was some inconsistency in the stored Out Hit.

My logic worked as follows:
make a sphere trace and store the Out Hit into a Variable then break the result and branch the Boolean Blocking Hit: on TRUE to the rebound logic and on FALSE to the second Line Trace, and, what do you know, this check wasn’t giving consistent results: sometimes wasn’t firing up (being executed) even if the Sphere Trace’s Out Hit was correctly stored into the variable.

So I tried, in addition to that, to store the Return Value of the Sphere Trace instead in a Boolean variable and, apparently, fingers crossed, knock on wood, that did it.

I get, until now and hopefully, consistent results with speeds up to 10000 U/s which is more than enough for the scope of my project in which the projectile is going to travel at 3000…4000 U/s TOP and if when balancing the game I need more there still some headroom available.

I want to thank you guys again for the suggestions and the advises, I didn’t get to try @Rev0verDrive’s because my logic wasn’t as close and I was too lazy to change path. Additionally I, stubbornly, felt like I wanted to come up with a solution by me instead of the built-in nodes.

And that’s it for now, I’ll add more if everything goes to sh*t again.

Now onto the next weirdness, inconsistency or bug. -.-"

1 Like

Hi,how’s it going.
so what you did is first do a sphere trace,if hit then it’s done,if not hit then do a extra line trace?
I’m not sure if I understand the middle part. you store the hit result as a variable?
I recently met a similar problem.the sphere trace is not reliable when speed is over 3000.

what exactly are you trying to do? Would be best to start a new thread and describe what you want to do and show what you’ve tried.

For the record I have PMC projectiles at 600,000cm/s velocities with a 0.1cm radius hitting sheet planes reliably.

1 Like