[SOLVED] Mesh collision issue

Hello.

I have trouble with collision between two entities.

  1. Player ship - dynamic primitive shape
  2. Plane - static mesh

The thing is, I can’t make plane primitive, because it will be a complex level, and I really need it to be a mesh.

How it looks like:

Why my ship is stumbling?

Also, I noticed that increasing vertex count in plane causes more problems, than if it is 8 vertex, player stumble less.

Obviously, problem appears only with mesh collider. When it’s box everything is okay:

Thanks a lot.
Mike.

Hmm, well it depends on how Ammo does mesh collisions I guess, but if it’s using the GJK algorithm then it’s notoriously difficult to get something to stay “on” a surface accurately - it’s probably small errors in the normal of the mesh box collision that are being used to solve the ship going through the surface, causing it to be pushed out further and have it’s inertia tensor applying slight roll in some cases.

Can you not “fake” this better (and way faster), by raycasting a number of points on the ship in the direction of it’s “DOWN” and then using those to work out where it should lie on the surface?

The next thing is the concavity of the mesh - clearly your plane is convex, but might your real world be actually concave in some way? Most physics engines balk at that because the only way to do tests is via triangle walking - which is fine for raycasts (though you don’t want to do many) but pretty terrible for physics as it has to be solved for every iteration of collision/interpenetration resolution.

1 Like

You could also try to remove any rotation tension manually, but I fear this is just pushing the issue somewhere else. IDK what your game is, but I’d always fake something like this using raycasts.

Thanks a lot for you reply, I decided to use raycast, how you suggested before.

So I added three points with magnetic levitation effect, and it works like a charm!

It’s even better for gameplay now!

Thanks a lot!

2 Likes

Yeah that looks great!!