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

Cinemachine and rolling ball solution

Discussion in 'Cinemachine' started by Bervt, Jul 6, 2020.

  1. Bervt

    Bervt

    Joined:
    Jun 19, 2020
    Posts:
    13
    hello ,

    wanted to use cinemachine for my player , since it is a rolling ball , cinemachine didn't work
    until i look back and say how stupid of me forcing my way of adding the player to follow

    The solution , create a empty object , with a script for him to have the same position of the player and not the rotation and puting it in the follow option of cinemachine .
    (the empty can be a parent to have a cleaner hiearchy , but you need to add to the scrip a line to unparent it , if not it will not work )

    Code (CSharp):
    1. public class Camerafollow : MonoBehaviour
    2. {
    3.     public Transform Player;
    4.     // Start is called before the first frame update
    5.     void Start()
    6.     {
    7.        
    8.     }
    9.  
    10.     // Update is called once per frame
    11.     void FixedUpdate()
    12.     {
    13.         transform.position = Player.position ;
    14.     }
    15. }
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    You can use the rolling ball player directly as a target. Make sure to set the vcam's Binding Mode to WorldSpace, so the rolling will be ignored.

    upload_2020-7-6_14-50-0.png
     
    Terrasense, Apeles and jeremyaboyd like this.
  3. Bervt

    Bervt

    Joined:
    Jun 19, 2020
    Posts:
    13
    nice , thank you !
     
  4. garvitmj14

    garvitmj14

    Joined:
    Nov 24, 2020
    Posts:
    1
    after the world space follow up my ball is unable to go back