Once again, I need some help. I'm using code below to get vector 3 rotated around point by angle : static func _rotate_vector3_around(var v3_pos,var v3_pivot,var y_angle): var dir = v3_pos - v3_pivot dir = Quat(Vector3(0,1,0),y_angle) * dir var point = dir - v3_pivot return point and trying to use it in code below : func _process(delta): cam_pos = Util._rotate_vector3_around(player.transform.origin + Vector3(0,2,5),player.transform.origin,angle) self.transform.origin = cam_pos func _input(event): if event is InputEventMouseMotion: angle = angle + (event.speed.x/400)

Problem is, if i move Player node (used as origin of rotation) camera still rotate around player's original position (0,0,0) Can someone help me and make my camera always rotate around player ? Thanks.

Uhm... well, nevermind. Looks like problem was in calculations. Line 3 of _rotate_vector3_around should be var point = dir + v3 pivot instead of var point = dir - v3_pivot ... ... ...i feel stupid...

5 days later

Something that is common practice when rotation a point, is to translate that point onto the 0,0,0. After it's put relative to 0,0,0 you perform a rotation on it, then put it back where it belongs.

Point to rotate round - Points location = relative to 0,0,0. Rotate point after put in relative placement. point to rotate around + Points new location after rotating around 0,0,0 = Rotated point around point to rotate around.

@newmodels said: Something that is common practice when rotation a point, is to translate that point onto the 0,0,0. After it's put relative to 0,0,0 you perform a rotation on it, then put it back where it belongs.

Point to rotate round - Points location = relative to 0,0,0. Rotate point after put in relative placement. point to rotate around + Points new location after rotating around 0,0,0 = Rotated point around point to rotate around.

Well, you just explained every line of my rotation code :) . You should know, I was using this code before GoDot in Unity3D. After I moved to GoDot I translated this GDscript function from C# method used before.I'm accepting it as answer because it is technically correct.

5 years later