- Home /
Question by
abel-solis · Nov 18, 2020 at 08:34 PM ·
cameracamera-movementcamera rotatecamera-lookcamera rotation
How to allow camera to complete an upside down rotation while using LookAt()
transform.position = Vector3.MoveTowards(transform.position, targetPoint.position, speed * Time.deltaTime);
Quaternion OriginalRot = transform.rotation;//camera original rotation
transform.LookAt(targetPoint.position);//stores a vector3 for the rotation camera should have to look towards targetPoint's location
Quaternion NewRot = transform.rotation;
transform.rotation = OriginalRot;
transform.rotation = Quaternion.Lerp(transform.rotation, NewRot, rotateSpeed * Time.deltaTime);
I'm using a script attached to a camera that essentially follows a path comprised of spheres. There's a part of the path where I want the camera to flip upside down but when the camera reaches a certain degree of rotation on the path, it decides to instead re-stabilize and not go upside down. I'm wondering if there's a way to allow the camera to complete that rotation without compromising the LookAt() part of the script that works fine for the rest of the path.
Comment
Your answer
Follow this Question
Related Questions
Camera movement according to rotation and actual position RTS 1 Answer
Camera gets stuck when cursor is locked 0 Answers
camera zoom 1 Answer