- Home /
Aligning/rotating vectors
Say I have two points, A and B. I can subtract A from B to find the vector pointing from A to B. Now, I'd like to rotate a model to be aligned with this vector. In my case, the model is a human character model, and I'd like to have it's shoulder be aligned with the vector we found. How would this be done? I've been trying LookRotation and FromToRotation, but I never seem to get the model aligned with the vector.
The larger problem I'm working on is that I have the raw positions (x,y,z) of the joints of a human (i.e. if i connect all the points, I get a stick figure). I want to rotate the corresponding joints of my model so that the model mimics the stick figure.
Any help or suggestions are very much appreciated!
Answer by bsubbaraman · Oct 01, 2018 at 09:55 PM
In case it helps anyone: my main oversight was that LookRotation() points the +z direction in the direction of the given vector. I was able to accomplish what I was trying to do using the answer from this thread: https://gamedev.stackexchange.com/questions/139515/lookrotation-make-x-axis-face-the-target-instead-of-z
Your answer
Follow this Question
Related Questions
Player not facing the mouse correctly 1 Answer
Rotating wrong 0 Answers
Using xbox controller with top down shooter 0 Answers
Bullet flies away for no apparent reason. 1 Answer
Help with hold x,y,z rotation 1 Answer