Bagai mana merotasi

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kwat

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 =
       new_mesh.mesh =
       new_mesh.translate(Vector3 (10,0,10))
       new_mesh.rotation_degrees(Vector3 (0,90,0))
:bust_in_silhouette: Reply From: Wakatta

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)

Thank you it work , i must learn and learn again

Kwat | 2022-12-12 02:28