Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Rotating a camera using slerp

Discussion in 'Scripting' started by almartin, Mar 26, 2015.

  1. almartin

    almartin

    Joined:
    Mar 5, 2015
    Posts:
    9
    I've spent hours trying to figure this out.

    Objective. Set a camera so that when the player clicks the right side of the screen the camera rotates 90 degrees to the right and keeps going round as long as they keep clicking right. Visa versa for left. I would like to use slerp for a fluid ease in and out motion.

    I've tried Quaternian.Slerp which is what I need but it doesn't work for angles from 270 to 0.

    I've found other examples that use Vector3 or eulerAngles but I can't seem to get them to work either.

    Can anyone help me to figure this out?

    Thanks Al
     
  2. almartin

    almartin

    Joined:
    Mar 5, 2015
    Posts:
    9
    Ok so I've managed to solve this.

    I found an asset call DOTween and I have to say it's excellent. It's solved all my easing and angle problems and gives me so much more options for what I wanted to do with my camera.

    It's really easy to set up and mega easy to use.

    https://www.assetstore.unity3d.com/en/#!/content/27676t