0 votes

hello I'm new in programming world, how do I rotate new_mesh when I use translate it works to move, but rotating new_mesh causes an error which contains no function rotate_degree in MeshIntace , is there any way to rotate new_mesh

func _ready() : 

       var new_mesh = MeshIntance.new()
       new_mesh.mesh = CubeMesh.new()
       new_mesh.translate(Vector3 (10,0,10))
       new_mesh.rotation_degrees(Vector3 (0,90,0))
       add_child(new_mesh)
in Engine by (17 points)

1 Answer

0 votes
Best answer

There is no function rotate_degrees in MeshInstance
There is only a member variable

new_mesh.rotation_degrees = Vector3 (0,90,0)

Which you should probably set using the following function

new_mesh.set_rotation_degrees(Vector3 (0,90,0))

Side Note

Most of Godot's variables use the setter / getter scheme and will be get_some_var() or set_some_var(value) or is_some_var_set() and only rarely you will get something random or stupid like _select_int(value), however that is being addressed in Godot 4 (at-least what could be deciphered from the source code)

by (6,870 points)
edited by

Thank you it work , i must learn and learn again

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 Frequently asked questions and 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 [email protected] with your username.