Rotate vector3 or basis.z

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

I want rotate a vector3 with degrees values, but in not have the corretly results.

My Vector value to rotate is this:
var camrot : Vector3 = get_node(“…/…/ShotPoints/right_point_position”).global_transform.basis.z

I search in doc of Unity for referenc, and I found this, I dont know how to fit in this in godot:

Sorry for my english, I studing the language.

Please describe how it’s not correct.

If you want to rotate a Spatial, you can call something like:-

getnode(“…/…/ShotPoints/rightpointposition”).rotation_degrees.y += 1

SteveSmith | 2022-10-01 07:33

:bust_in_silhouette: Reply From: aXu_AP

Vector3 has rotated method for rotating it around some axis. For example, if you want to rotate around y-axis 90 degrees:

camrot = camrot.rotated(Vector3.UP, deg2rad(90))

Basis has similiar function too, if you want to rotate whole basis.