- Home /
Get Direction from 2 Vectors - and Apply to Transform
Hello,
I've found out how to get the direction from 2 Vectors by doing:
Vector _direction = _aVector - _bVector;
I now want to apply that direction onto a transform. I tried doing:
transform.eulerAngles = _direction;
With no luck - it only seems to change the rotation ever-so-slightly.
I want to be able to change the rotation of my object based on the two vectors within my scene, like so:
I know I can achieve this via Vector3.Angle, which will return me a float - but I want this to be applied in 3D space. Thanks
Will you use it for 2d? Are you rotating one object towards the other or does the rotating object have different position than the vectors you are using for calculation?
Hello, no I'm not using it for 2D. I basically just want to calculate the rotation between _a and _b, and then apply that rotation to my _object.
Your answer
Follow this Question
Related Questions
How to get offset postition after rotation ? (Spent hours figuring it out) 3 Answers
3D nested Turret Prefab Rotation 1 Answer
Dynamically change Vector3.up/right?,How to make a cylinder chase mechanic? 2 Answers
Rotating a direction Vector3 by Quaternion 2 Answers
Set rotation based on 1,1,1 style vector? How to convert vector3 to quaternion? 1 Answer