M
M
marshadow2020-10-22 07:38:18
Nginx
marshadow, 2020-10-22 07:38:18

How to rotate a normalized vector to another normalized vector?

I'm making a game from scratch, and I ran into a problem, for example, there is a vector (1; 0) is the direction vector of the beam that comes from the player's gaze, and there is a player's direction vector, for example (0.69; 0.3), what formula to rotate the direction vector ray to the player's direction vector so that even if the player is spinning, the ray is in the same position relative to the player's direction vector?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2016-04-06
@AlexListen

Something like this
server {
server_name "~^www\.(.*)$" ;
return 301 $scheme://$1$request_uri ;
}

V
Vlad Zhivotnev, 2016-04-05
@inkvizitor68sl

No way, the browser will not be able to establish a connection with www.blabla.domain.com, because. no valid certificate. Well, that is, it can, if you click "yes, yes, I don't care" on a very red and scary page.

G
Griboks, 2020-10-22
@marshadow

The idea is simple - to inherit (by classes, components or objects in the hierarchy) the camera from the player. Then the camera will always be relative to the player in a fixed position (and will rotate with the player). Those. together with the player, you rotate all of his children as you move the mouse.
If we are talking about the rotation of the vector, then the question is incorrect. You have a vector a and a vector b which is the rotated vector a. What do you mean by rotation when you have a start (a) and end (b) position of a vector? You can only rotate by an angle, not by another vector. But if you rotate a by an angle between a and b, then you get b (they are normalized, after all). Now, if we are talking about vector rotation, then see the rotation matrix. But keep in mind that the ray is usually rotated relative to some point, and not an abstract vector.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question