![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | GameVisitor |
Hi all,
I created a simple scene with just a rigid body with the following children:
- mesh node (cube expected to be 8 vertex ?)
- collision
- other stuff (such as audio , non visible nodes…)
The debug monitor is showing 72 vertices drawn
… is this expected or I am missing something trivial ?
Thx
I don’t know about 72 vertices, but a flat cube will have at least 4*6=24 vertices, since for every side of the cube the normals can’t be shared, since they need to point straight into the direction of the side. If you wanna know what I mean, create a cube in Blender and switch it to smooth shading. That cube will have 8 vertices but won’t look like the cube you see in Godot.
omggomb | 2019-02-17 15:31
Hi @omggomb,
Thx for your feedback but i didn’t full understand it.
Also i tried the shading → smooth / flat switch in blender, it only changed visually, but blender kept on saying it is 8 vertices…
Hope you can clarify / prove your answer better.
Thx again
GameVisitor | 2019-02-17 17:01
I am so confused, I added a plane mesh and counts 12, while cube has 72, seems like every vertices has another vertices for normals. idk
I also try creating mesh from code, and if my guess is true then my mesh made from code did not divide as couple of triangles but a whole square, but if my guess is false, well I do not know anymore XO
here is my script:
extends Spatial
var tmpMesh = Mesh.new()
var vertices = PoolVector3Array()
var UVs = PoolVector2Array()
var mat = SpatialMaterial.new()
var color = Color(1, 1, 1)
func _ready():
vertices.append(Vector3(-0.5, 0, -0.5))
vertices.append(Vector3(-0.5, 0, 0.5))
vertices.append(Vector3(0.5, 0, 0.5))
vertices.append(Vector3(0.5, 0, -0.5))
vertices.invert()
UVs.push_back(Vector2(0, 0))
UVs.push_back(Vector2(0, 1))
UVs.push_back(Vector2(1, 1))
UVs.push_back(Vector2(1, 0))
mat.albedo_color = color
var st = SurfaceTool.new()
st.begin(Mesh.PRIMITIVE_TRIANGLE_FAN)
st.set_material(mat)
for v in vertices.size():
st.add_color(color)
st.add_uv(UVs[v])
st.add_vertex(vertices[v])
st.commit(tmpMesh)
$MeshInstance2.mesh = tmpMesh
pass
func _process(_delta):
$MeshInstance2.rotate_z(0.01)
pass
Decemberfrost | 2021-02-23 11:44