- Home /
How to adjust the rotation of objects?
Hello
Im instantiating a bunch of object and some of the are curved by 30 or 45 degree. The rest are straight objects. All of them form a map.
I want to know how i adjust the rotation for the curved objects. At the moment all the information i have is where object start and stop. Two point in space.
Vector3 ElementPosition = FindElementPosition(e);
var Rotation = CalculateRotation(ElementPosition, e);
Instantiate(Straight, ElementPosition, Rotation );
This code aligns all the straight objects by calculating between start point and end point direction vector.
I know when there is a curve of 45 to the right, then i need to adjust approximately either negativ or positiv 20 degree around my up axis.
So basically if i have a rotation that tell the object to rotate 11 degree and i find that the object is a curve (45) i would like to increase or decrease by 20 degrees depending on whether it goes left or right.
How do i do this in Unity?
Your answer

Follow this Question
Related Questions
Quaternion.RotateTowards() immediately snaps to target rotation 1 Answer
How To Prevent Axis Fliping When Rotating 0 Answers
Smooth rotation about global axis instead of local axis. 1 Answer
Why is this rotation not performed as expected? 1 Answer
Choose starting point/angle for rotation with cos and sin 0 Answers