Small physics objects passing through walls

I have some small objects that simulate physics. A fork and a knife. The player can add an impulse to these objects.

Sometimes they go through walls and floors. This is with CCD enabled.

Both the fork and the knife are modeled using real-life measurements. I added a simple box for collision.

The knife’s height is 34 uu. Its velocity vector length is about 3200.

My question is… can I make the collisions more accurate without resizing the box collision?

Some time ago i found out that if velocity is too high objects can pass trough.

3200 Velocity doesn’t seem like much. Or am I wrong? Should I use other methods to make my objects move? Like the Add force node?

This all depends. Basically if physics engine can catch projectile colliding it will recalculate positions and raise events. And colliding depends on velocity, thickness of wall collision and thickens of projectile collision, and on FPS.

However to make sure if its because of velocity, lower it to 500 or even less and see if those errors still happen.

ps.
i think 3200 velocity means 3200 m/sec. Which means you have hypersonic knifes in game. ie 11520 km/h (7158 miles/hour). Do you making superman game by any chance? :smiley: (it may be alos 3200cm/hour, which makes 71 miles/hour) :wink:

pps.
if you have code that calculates anything on event tick, you should adjust values for delta time.

This is something I’ve looked into for a projectile system, and the solution I ended up using was making the Collision Box the Root Component, and adding a Projectile Component to detect hits. The Collision can then have its physics enabled and can be manipulated to add things like impulse, and the Projectile Component handles the actual hits.

I believe the Projectile Component utilizes substepping by default, and its hit outputs are more accurate/quicker/reliable than a Collision’s overlap detection. The downside is that Projectile Components are apparently a little bit non-performant.

You could also run a line trace from the center of the object, positioned/scaled to its forward velocity. I’m sure there are other solutions out there as well so I’d suggest looking into accurate physics objects and high-speed projectiles if you haven’t already as they’re representative of the same idea, even if your flying utensils aren’t moving especially quickly.

I recorded a video so you can easily see what’s happening.

The objects do not move at any crazy speed.

In this video, I increased the size of their collision and still, at the very end you can see a knife going through the wall.

I understand what you’re saying but I’m really surprised I have to implement line traces for such low velocities.

I thought I did not setup my objects properly, that maybe I missed something.

I also enabled substepping but it didn’t really helped.

Do the math then.

Wall thickness vs Object size * speed per tick.

Whever the wall thicness is smaller than the object@speed you have possible penetration.

So a 1cm bullet flying at 2m per tick
And a wall of 10cm will almost always result in no collisions.
In fact, you can guess the rate of hits to be equal to 2/.10 or about 20%…

A quick cheat would be to scale the collision capsule in the direction of travel by speed of travel.
So each tick your collision is sweeping the whole pathway regadless of substepping etc.
Obviously you end up hitting a wall way before the wall is reached if you increase speeds a lot.

So if I’m having a low framerate the collisions will almost always be wrong.

I’m assuming I have to use line traces to check for collision if I want to avoid resizing the collision box.

Right?

What does the end of your knife look like? My assumption is that the collision on your knife’s mesh comes to a single vertex at the knife’s edge, or is otherwise incredibly thin. I ask because the knife in the video phased through the wall at a much lower velocity than it was hitting the wall earlier, and as it was coming down on its tip. If that’s the case then a simple solution would be to just manually scale up the knife mesh’s collision.

I tested it myself with very thin rectangles (5 cm x 10 cm x 1 mm) placed within 5 cm^3 Box Collisions and provided a very powerful impulse and still they collided with the wall more frequently than not. Applying CCD to both the mesh and the Box Collision seemed to add additional accuracy and it now takes some effort to get them to phase through the wall.

With that being said, you could still use a line trace. Line traces are probably more efficient than any physics adjustment and are neater than scaling the collision box, but require some math to get the kind of behavior you’re looking for. It’s doable, but I made that suggestion earlier because I mistakenly thought you were looking for an accurate hit rather than multiple physics bounces.

@dB035

This may be reason.

@Balaurul

Make CAPSULE collision for knifes, you can edit it in mesh editor (open knife mesh in content browser by double clicking it). Then you can change to capsule and edit its height and radius.

At this stage only solution is to change step by step all elements until you find one making trouble.

You can see in the first few seconds of the video that the collision is a simplified box with an increased size.

I have used the capsule collision as an alternative and I don’t want to use it because the knife will now roll witch looks really bad. I couldn’t make the object to penetrate walls in my testing.

It is also really hard to test since it does not happen often but it does happen.

Point of trying capsule is to try something else. If passing trough stops with capsule You will know it is collision shape. So then you can make custom collision until you find shape that suits all requirements. And capsule is second most efficient collision right after sphere.

First of all, look into substeps.
There’s no reason that the collision has to be frame dependent (but then make the calculations using the sub stepped values).

Second, if you use the projectile system stuff will run better in terms of collision at least. If you can, you may want to consider that.

Third. You can make your walls have a 10m deep collision, and it should automatically stop penetration assuming the math checks out.
That’s Easy to do on outer walls, and not possible for walls in the middle of a level though, so…

Fourth, Correct. Don’t rely on physics. Particularly since Chaos the system is a mess (apt name really). You have very little control and really bad/inaccurate simulations most of the time…
So see point 2…

I know I can trick players and it doesn’t matter what is going on under the hood as long as the player doesn’t notice.

That being said, my goal is to make a simple kitchen scene where metallic objects like spoons, forks and knives get attracted to the player.

One thing that I want in particular, is a few knives placed inside one of those wooden knife holders, smoothly coming out as they are attracted.

This requires very precise collision. I would love to simply have everything powered by physics and no animations. However, that might not be possible to achieve what I want.

How would you guys create such a scene?