Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to limit camera rotation?

Discussion in 'Cinemachine' started by GentleManiac, Jul 18, 2017.

  1. GentleManiac

    GentleManiac

    Joined:
    Dec 15, 2012
    Posts:
    2
    I have a static scene and I want my camera to slightly rotate around the scene based on cursor position on screen. Just to make a little parallax, like those 3d menus. How do I do something like that?
     
  2. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    Do you want to move the camera around while pointing at the same spot on the screen? You could use transform.LookAt() for that. You might need to find ways to smooth and dampen abrupt movement if that's not what you want, but keeping the camera focused is the easy part.
     
  3. GentleManiac

    GentleManiac

    Joined:
    Dec 15, 2012
    Posts:
    2
    i was wondering if I can to it with Cinemachine alone. But I guess I can just move virtual camera with script wile letting it aim by itself.
     
  4. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    I haven't tried that, but if it's for cut-scene purposes it might be the right tool for the job. If it's for interactive use, custom scripting is the way to go.
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Should be able to do that nicely with CM. Try using an orbital transposer and animating its HeadingBias based on cursor position.
     
    orb likes this.