Search Unity

Question World Up override working incorrectly with POV

Discussion in 'Cinemachine' started by Goldiath, Apr 25, 2023.

  1. Goldiath

    Goldiath

    Joined:
    Feb 12, 2022
    Posts:
    6
    Hey, for the past week or so, I've had trouble with getting a VCAM to do what I thought would be really simple.
    In the video below, the VCAM is set to follow the cube (not via parenting) with a POV aim, as well as to have its up vector overriden by the same cube.



    As you can see, the camera rotates in the exact opposite direction, and I have no idea why.

    For context, this used to work correctly last year until it just...didn't. I took a break from the project due to uni, so I don't remember when or how this happened.

    I'm at my wits end, and everything I've tried for a workaround has either had other issues or just didn't work. Google didn't help either, and I think I'm the only one with this exact issue (or I just didn't look hard enough).
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Can you show your vcam inspector?
    Also, which version of CM?
    Also, can you please show the cube's transform? Does its rotation start at Identity?
     
    Last edited: Apr 25, 2023
  3. Goldiath

    Goldiath

    Joined:
    Feb 12, 2022
    Posts:
    6
    Unity_2023-04-25_14-23-38.png Unity_2023-04-25_14-23-23.png Unity_2023-04-25_14-23-15.png

    Here you go.
     
  4. Goldiath

    Goldiath

    Joined:
    Feb 12, 2022
    Posts:
    6
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Thanks. If you're trying to make a POV camera, the best way to do that is to put Do Nothing in Body, and make the virtual camera (with the POV behaviour) be a child of the cube. POV adds pan and tilt in the reference frame of the vcam's parent object. Setting a WorldUp override only affects the up vector, not the entire world axes, so it won't do the job.
     
  6. Goldiath

    Goldiath

    Joined:
    Feb 12, 2022
    Posts:
    6
    Thank you for the responses, they're really encouraging, but I should apologise for not saying exactly what I want this camera to do.
    As for what you've suggested, it wouldn't work for me as when the cube (or player) rotates, it drags the POV aim along with it, which is very jarring.
    Essentially, the player character can be equated to a car/bike, and I need the player to be able to look out from the front of the vehicle so that the up direction always matches that of the car's (or cube's), and for the aim to only be affected by e.g. a value range on the horizontal axis, otherwise it should maintain direction.
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Still not clear for me.
    What are you trying to model?
    In the case of a driver sitting in in a car, the POV would represent the head movement, and the parenting would represent the relationship between the driver and the car. When the car turns or rolls, so does the player, but the head can still pan/tilt on top of that. Is that not what you want? If not, please elaborate.
     
  8. Goldiath

    Goldiath

    Joined:
    Feb 12, 2022
    Posts:
    6
    What I want is just as you said, except without the camera's POV aim being dragged along with the car's rotation on its y-axis, like in this example.



    If I don't parent the camera, but instead set it to follow the player via the inspector, then this is fixed, but as a downside, the incorrect tilting I showed first returns.
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Your video shows the camera rotating along with the car's Y rotation. Is that what you want or not what you want?
     
  10. Goldiath

    Goldiath

    Joined:
    Feb 12, 2022
    Posts:
    6
    It's what I don't want.
     
  11. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Hmmm... POV will work by applying pan/tilt in either a local reference frame or a global one. There is no option to use local reference with a world yaw. You would have to make your own customized version of the POV to implement that. There will be edge cases to worry about - e.g. what if the up override is the same direction as the look direction?

    In any case CM 2.8.9 POV is buggy with world up override, so the behaviour is incorrect. Even if it were correct, it would not give you what you want.

    Can you describe the use case more fully? You can DM me if you don't want to go into it publicly. There might be alternatives to POV that will bring you closer to your goal.
     
    Last edited: Apr 26, 2023