I'm new to the engine and I'm getting desperate. Even the most basic operation takes hours to be set straight. I just don't understand this stuff or why, when I finally find the function I'm looking for, looks like it doesn't work for X reason.
What I'm trying to do:
when I click a specific button, an MeshInstance node is set to a specific mesh and its position should be set relative to the origin.
My code:
func toSphere():
print (a)
self.mesh = SphereMesh.new()
global_translate(Vector3(0, 0, 0))
func toCube():
print (a)
self.mesh = CubeMesh.new()
global_translate(Vector3(0, 0, 0))
func toHead():
print (a)
self.mesh = getnode("MeshHead").mesh
global_translate(Vector3(-0.574,0.91,0.684))
What happens:
Function "toHead" moves the mesh how it's supposed to be moved, but when I click the others (that are supposed to move the MeshInstance back to world origin) the MeshInstance just stays there. That also means each time I activate the "toHead" function the MeshInstance adds another offset.
Halp pls.