I wanted to make sound physics script (for every sound node) which rotates RayCast3D Node towards the player and checks if it collides him, but idk how to do it. (ik how to check what ray collides i just want how to make RayCast3D rotate towards player)
Here is a picture for you to understand what I mean:
look_at takes an up Vector. In the documentation that @Opalion linked to it says:
"The local up axis (+Y) points as close to the up vector as possible while staying perpendicular to the local forward axis. The resulting transform is orthogonal, and the scale is preserved. Non-uniform scaling may not work correctly.
The target position cannot be the same as the node’s position, the up vector cannot be zero, and the direction from the node’s position to the target vector cannot be parallel to the up vector."
If it does a little dance or just starts acting oddly it’s probably because of that last part. Before calling the function you could (possibly using the dot product Vector math — Godot Engine (stable) documentation in English) check if the vector to the player and your chosen up vector are parallel, and if they are use a different up vector instead.
Which alternate up vector you use is up to you. It’s used to determine the roll, so if it’s just being used on a RayCast3D (which is invisible and doesn’t care about roll) then it doesn’t really matter, so long as you don’t use your original up vector or its opposite.