0 votes

If for example I have a blue sphere MeshInstance and a red cube, can I change the sphere to the shape and look of the box?
I've tried something like this:

    get_node("BlueSphere/MeshInstance").set_mesh(get_node("RedCube/MeshInstance").get_mesh())
 get_node("BlueSphere/MeshInstance").set_surface_material(0,get_node("RedCube/MeshInstance").get_surface_material(0))

And although I can then read the properties, eg albedo, of the Blue Sphere (which I now want to look like a red cube), it doesn't appear in the scene. I think I'm either missing some step(s) or conceptually this is not an ok thing to do.

in Engine by (24 points)

1 Answer

+1 vote
Best answer

This is actually a valid way to go about this. Try again and fiddle with it, there's probably something with your specific scene. As soon as you retrieve a value with a getter, it is just a value seperate from the source object, because the function returned the value to you. And you can set the value of a property to any given value as long as it matches its data type.

by (840 points)
selected by

Once you said it's a valid method, I dug around a bit and found the missing object way out in space because the (imported) object I'm copying has a huge translation to bring it back to (0,0,0). So thank you very much for your help.
As far as I can tell, there's no way to move the origin in the editor, but I can work round this.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.