ArrayMesh for Terrain not working
Asked Answered
A

5

0

So, i have a problem with my terrain in which i need to include a mesh to make the collision that i want to add to my terrain match it's form, which is a little complex, and a simple mesh as a box or plane cannot fulfill. Then i discover that a mesh of the type "ArrayMesh" is best 'cause it seems to replicate the form of the object that it's included. Good, now i just need to add this type of mesh to my terrain, and then when i apply a collision it will make the exact form of the mesh. Problem is, it isn't working, the Array mesh is not appearing and it isn't doing anything, even when i try to add the collision.

I already tried reimporting my terrain object into the scene again, but came to no avail. Tried deleting the object from the files and exporting from blender to godot again, and still nothing. The file of the terrain is below, as well as prints from godot.

ground-battlefield.zip
245kB

Arcboutant answered 15/11, 2023 at 23:20 Comment(0)
G
0

Did you add the vertices to the ArrayMesh?

Germinant answered 16/11, 2023 at 3:3 Comment(0)
A
0

Germinant how exactly could i do that?

Arcboutant answered 17/11, 2023 at 1:53 Comment(0)
G
0

Like it shows in the documents: https://docs.godotengine.org/en/stable/classes/class_arraymesh.html#description

Germinant answered 17/11, 2023 at 2:16 Comment(0)
A
0

Germinant Oh, right, so i should add manually the code for it to work? I get now that an ArrayMesh, by the name, already explains that, but it would be just too difficulty for me to manually code the mesh so it matches the complex terrain. How could i do that more easily? You see, the terrain has little hills and trenches, so to make the mesh match it simply by eye would be too difficult to make, is there any way i can automatize the process?

Arcboutant answered 17/11, 2023 at 14:27 Comment(0)
S
0

Arcboutant Select the mesh instance node containing the terrain mesh. In 3D viewport toolbar the Mesh button will appear. Click it and select one of automatic collider generation options from the menu. For a static terrain you can use Create Trimesh Collision Sibling. This will create a collision shape node with a concave mesh shape containing vertex data from your mesh instance.

Selfannihilation answered 17/11, 2023 at 16:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.