+1 vote

How do I deform a car mesh when it is colliding? (car crash)

Is there such a thing as csg-subtraction for normal meshes?

in Engine by (168 points)
edited by

Deforming a mesh is different than subtracting from it. Are you trying to simulate a car crash?

Yes, I want to program a car race with accident simulation (one car crashes into a wall or several cars crash into each other)

You could try several methods and see which one works best. For example, you can use bones and animate them to deform the car as if it's crashing (could be tedious, but more controllable). Or use a car that is made of different parts (maybe by slicing it randomly) and seperate the parts upon impact (Possible but I don't know how to do it).

Thank you for the idea with a skeleton. I think I will use it.
So there is no way to deform a mesh with only one mesh and a few lines of code?

It is possible to change the position of any vertex in a mesh, but the challenge is to make this modification work the way you want, You have to decide which vertices should be moved, when and what is the offset for each vertex?

Vertices are referenced by index too, so it is extremely hard to manually animate a mesh using code, using vertex shaders is easier but still not suited for animating car crashes quickly.

Skeletons are more straightforward because you can have poses that are set interactively and blend between them in a variety of ways, then finally play the deforming animations when your cars crash using code.

I agree that moving vertices in code is difficult, but if someone wants to do this, they should take a look at the Godot MeshDataTool.

Now I have a few Ideas how I can deform my car.
Thank you very much.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.