From the bezier curve image above, how can I set the angle r
manually, so that changing it does not affect the distance between A
and B
?
Answer
// Form the direction the tangent should point when the angle is zero.
var zeroAngleDirection = (D - A).normalized;
// Compute a rotation by the desired angle, clockwise about the positive z axis.
var twist = Quaternion.Euler(0, 0, -angle);
// Set point B a desired distance away from A, in the rotated direction.
B = A + twist * zeroAngleDirection * desiredLength;
No comments:
Post a Comment