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. Dismiss Notice

Question How to force POV vCam z axis by code

Discussion in 'Cinemachine' started by djorgri, Aug 11, 2022.

  1. djorgri

    djorgri

    Joined:
    Jan 3, 2011
    Posts:
    17
    Hello,

    I am trying to make a FPS type game with the ability of having my character controller running around a small planet, i chose to use CineMachine for its cinematic capabilities.
    I overrided CinemachineInputProvider.GetAxisValue(int axis) in order to have full control on my x and y axis.

    I would also need to override the z axis for gravity orientation reason, but i cannot find a way to make this function called at each update.
    I assume it would need a Vector3 as an input, which i cannot provide.
    Is there a way to simulate it, or a better approach (like overriding main camera z axis after cinemachine brain update)?

    Thank you for your time!
    Kind regards.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,233
    I'm having some trouble understanding what you are asking. I don't see why overriding the input axes is relevant.

    Please have a look at our SphericalSurfaceFollow scene, included with the CM samples. It implements a FreeLook camera following a character that moves on the surface of a sphere. It uses the WorldUpOverride feature of the CM Brain.

    Is that similar to what you're trying to implement?
     
  3. djorgri

    djorgri

    Joined:
    Jan 3, 2011
    Posts:
    17
    Hello!

    Thank you for your answer, and sorry if my english may be inacurate.
    This is exactly what i was looking for!
    You are totaly right that with the WorldUpOverride, it is useless to override an input axis as i wanted to (as a kind of hack).

    Just for information for anyone passing by, having worked further on my proto, the builtin character controller does not seem to fully work with partial reverse orientation.
    This a different subject and i will post in the right section if needed.

    Thank you again!
    Have a nice day.
     
    Gregoryl likes this.