0 votes

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 = getnode("../../ShotPoints/rightpointposition").globaltransform.basis.z

I search in doc of Unity for referenc, and I found this, I dont know how to fit in this in godot:
https://answers.unity.com/questions/46770/rotate-a-vector3-direction.html

Sorry for my english, I studing the language.

Godot version 3.4.4
in Engine by (12 points)

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

1 Answer

0 votes

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.

by (1,094 points)
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.