Godot Engine

Godot Engine

なかの31 Jun 10, 2023 @ 11:26pm
Procedural Mesh. What to use for a modifiable mesh?
I'm scratching my head trying to figure out how I'll do this.
I thought at first, that making a dictionary with the vertices logged in it and then changing the value through it would alter the meshs, and yep, I was wrong.

Since my skill with 3D modeling is demi null (I had quite a struggle making a basic tent design on Blender), I decided to use programming to generate the terrain on my game project. The thing, is that I want to try using the engine itself, to help me model the world while in-game. For that, I need some way of altering the terrain while in-game, and that's where the problem lies.

By now, I was using ImmediateMesh to create the terrain mesh, and it actually worked.
The problem lies on the part of modifying the mesh, which seems impossible. Seems like I have to recreate the terrain mesh all over again to change anything in the mesh.

The other alternatives, like SurfaceTool and MeshDataTool doesn't seems like they do what I want to do, which leaded me to ArrayMesh.
I thought ArrayMesh would make my job easier, since I could index the vertices, until I gave a thought and... Does the indexing also affects Normals, UV and stuff?

Now I'm stuck without ideas of what I can do regarding mesh manipulation, or what alternatives I can use.

Anybody has ideas? Or do I have to recreate the mesh anytime I want to change it?
Last edited by なかの31; Jun 10, 2023 @ 11:26pm
< >
Showing 1-4 of 4 comments
Romløk Jun 11, 2023 @ 11:51am 
I've not done dynamic meshes myself, but from what I can tell it seems like MeshDataTool should be exactly what you need, so it's not clear to me why you discounted it?

MeshDataTool provides access to individual vertices in a Mesh. It allows users to read and edit vertex data of meshes.

Alternatively, depending on the nature of the modification you're after, you could try using bones, or a vertex shader?
なかの31 Jun 11, 2023 @ 4:50pm 
Hm. I must have missed that about MeshDataTool when juggling the documentation, trying to find the best way to do that.
I'll check out MeshDataTool.

As for bones or vertex shader, I have no idea how to use them yet.
Beside, since Unity, I have issues handling shaders.
Arkinum Jun 12, 2023 @ 6:45am 
I'm still teaching myself 3D stuff in Godot, but as mentioned, using bones would probably be the solution I'd go for.

If you're making a 3D game then character rigging is likely a skill to learn regardless.

You can even just rig your terrain in Blender and import as an animation if it doesn't need to be dynamic. Then you can easily just use the animation node(s) to make the deformation happen.

The only thing I'm not sure on is how colliders will react to the deformations.
なかの31 Jun 13, 2023 @ 1:26am 
The problem would be the colliders, since the collider requires to update the vertex position aswell.

Also, I don't need to worry about rigging 3d characters, since my game characters are 2d. :P
< >
Showing 1-4 of 4 comments
Per page: 1530 50

Date Posted: Jun 10, 2023 @ 11:26pm
Posts: 4