Godot Version 4.7
Question
So i’ve been trying to get my rope visual to work, like it got everything it should, but for some reason one side of it is just “shrank”, i can’t really figure out how to fix it.
i even did a little a little schematic to see if i placed the vertices correctly
Here’s the code for my rope thing (mostly copied from the immediate mesh documentation, except i changed it to fit in what i was doing):
extends MeshInstance3D
@export var start = Node
@export var target = Node
var endPOS = Vector3()
var startPOS = Vector3()
func _ready():
endPOS = target.global_position
startPOS = start.global_position
mesh.surface_begin(Mesh.PRIMITIVE_TRIANGLES)
# Prepare attributes for add_vertex.
mesh.surface_set_normal(Vector3(0, 0, 1))
mesh.surface_set_uv(Vector2(0, 0))
# Call last for each vertex, adds the above attributes.
mesh.surface_add_vertex(Vector3(startPOS.x, startPOS.y + 0.1, startPOS.z))
mesh.surface_set_normal(Vector3(0, 0, 1))
mesh.surface_set_uv(Vector2(0, 1))
mesh.surface_add_vertex(Vector3(startPOS.x, startPOS.y - 0.1, startPOS.z))
mesh.surface_set_normal(Vector3(0, 0, 1))
mesh.surface_set_uv(Vector2(1, 1))
mesh.surface_add_vertex(Vector3(endPOS.x, endPOS.y + 0.1, endPOS.z))
# End drawing.
mesh.surface_end()
mesh.surface_begin(Mesh.PRIMITIVE_TRIANGLES)
# Prepare attributes for add_vertex.
mesh.surface_set_normal(Vector3(0, 0, -1))
mesh.surface_set_uv(Vector2(0, 0))
# Call last for each vertex, adds the above attributes.
mesh.surface_add_vertex(Vector3(startPOS.x, startPOS.y - 0.1, startPOS.z))
mesh.surface_set_normal(Vector3(0, 0, -1))
mesh.surface_set_uv(Vector2(0, 1))
mesh.surface_add_vertex(Vector3(endPOS.x, endPOS.y + 0.1, endPOS.z))
mesh.surface_set_normal(Vector3(0, 0, -1))
mesh.surface_set_uv(Vector2(-1, -1))
mesh.surface_add_vertex(Vector3(endPOS.x, endPOS.y - 0.1, endPOS.z))
# End drawing.
mesh.surface_end()

