Convex collision shape and trimesh collision shape slow down everything to the point where the game is unplayable

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By johnygames

In an effort to create a collsion mesh for a rigid body, I created a Convex collision shape (from the mesh menu that appears when a MeshInstance is clicked). As expected, a shape encompassing the object appeared. However, when the object spawns in game, the game slows down to the point where it breaks. The exact same, if not worse, happens if I try to generate a trimesh collision shape. But when I use simple primitives as collision shapes, everything goes without a hitch. Is there something I am missing with convex shapes?

:bust_in_silhouette: Reply From: Skipperro

I had the same issue while using move_and_slide() and it was colliding with trimesh. I fixed it by setting max_slides=1 on move_and_slide().

I don’t know why it works for me and how, but I’ve got no more slowdowns. You could try this, if you are also using move_and_slide() function.

https://docs.godotengine.org/en/3.1/classes/class_kinematicbody.html#class-kinematicbody-method-move-and-slide

Thanks for your response.

I think it isn’t working though. Here’s my code:

move_and_slide(velocity,  Vector3(0,0,0), false, 1, 0.785398, true)

The code is working, but the game still slows down to the point of crashing. Am I doing something wrong with the method’s parameters?

johnygames | 2019-07-31 16:31

This is exactly what I use. Try it out:

move_and_slide(MoveVector, Vector3(0,0,0), true, 1, 0.3, true)

MoveVector is in my case the direction I want to travel + calculated movement down due to gravity. My map have only light slopes, so maybe this 0.3 instead of 0.78 makes a difference.

Skipperro | 2019-07-31 16:41

Nope, the problem persists. It mustn’t have anything to do with the slope. The moment the objects spawn in the world the game slows down.

johnygames | 2019-07-31 18:22