Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

hi there,i have a question, please help me !

Discussion in 'Cinemachine' started by gabriella11, Jul 28, 2018.

  1. gabriella11

    gabriella11

    Joined:
    Jul 28, 2018
    Posts:
    1
    I want a head bob to resemble the one in Silent Hill PT, which is a sinusoidal head bob without noise, and it applies when the character is walking. This is important, because for idle it ahs another head bob, which is sort of different. What I used to do, is animate the camera in the animation window, and by code switch and interpolate animations. But screw that method, because not once did I ever get something satisfactory, there was always obvious camera lag while blending and overall it didnt feel that good.
    Out comes cinemachine, with apparently everything I seem to need to do it. I managed to put some perlin noise, but as I said, I wanted a predefined movement, which I want to animate myself. How can I animate it myself and use cinemachine and timeline for the blending of movement? All I see there are some default presets and I can only change 2 values.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,416
    We don't have anything out-of-the-box yet for head bobbing, but it's on our to-do list.

    In the meantime, the best way to do it would be with a custom CinemachineExtension. Have your custom extension add the bob motion to the vcam's PositionCorrection field of its state (it's a position delta, so a simple sinusoidal motion about 0 on the Y axis should do the trick). This way it will coexist with Perlin noise and other stuff, and will blend.

    See this post for a sample CinemachineExtension: https://forum.unity.com/threads/how-to-shake-camera-with-cinemachine.485724/#post-3416266
    The code there randomly shakes the camera, but you can use it as a jumping-off point for your head-bobbing feature.

    Good luck! If you come up with something cool, don't hesitate to share it here :)

    PS you can copy the Perlin Noise presets and customize them, or make your own using the Noise Settings editor. It can be used to generate all sorts of signals, including non-random sinusoidal ones. Click on that little gear icon for options:

    upload_2018-7-31_6-59-54.png