- Home /
Question by
LaurynasLubys · Aug 26, 2017 at 02:48 PM ·
quaternion.slerp
Quaternion Slerp/Lerp doesn't work
Hi, I want to create smooth rotation of flashlight movement in the wrist. Everything works fine now, but I cannot get smooth rotation from original angles to new angles by using slerp or lerp functions. Whenever I try something it stops working or just ignores interpolation. Perhaps I did some mistake in previous lines before using interpolation at the end?
private void Aim()
{
//Flashlight
aimDirection = pointer.transform.position - aimer.transform.position;
rotationToObject = Quaternion.LookRotation(aimDirection);
wristRotation = Quaternion.RotateTowards(rightWrist.rotation, rotationToObject * Quaternion.Euler(new Vector2(90, 0)), 110);
rightWrist.rotation = Quaternion.Lerp(rightWrist.rotation, wristRotation, 0.9f);
}
Thank you.
Comment
Your answer
Follow this Question
Related Questions
Stage selection problem 1 Answer
How to make character rotate in the direction of movement and direction of the camera? 1 Answer
Using Quaternion.Slerp() to rotate an NPC. 1 Answer
Clock script with custom time not working 0 Answers
Transform rotation and position on key input: rotation only working the first time 2 Answers