Forum rules - please read before posting.

Camera framing and direction factor

edited June 2019 in Technical Q&A

Hi!

I like the "Target direction factor" allowing the camera to show more of whats "ahead" when a player is moving. However, a side effect is that a "Character: Face direction" causes this factor to come into play even without the character moving. This looks very jarring and I wonder if there is a way to only have the direction factor come into play during actual movement.

In a perfect world (like totally perfect) there would also be a separate follow speed for when the camera is compensating for the direction factor as opposed to the follow speed when the character keeps moving in the same direction. I prefer a fast camera following the player but a slow camera when compensating for facing direction...

Thanks!

Comments

  • I'm not sure how useful others would find this kind of specific fine-tuning, but bear in mind that all of this is open for you to tweak as necessary: the GameCamera2D / GameCamera2DEditor scripts can both be duplicated, renamed, and modified to suit your needs.

    The "Target direction factor" is determined by the GameCamera2D script's "directionInfluence" vector. To have it also incorporate the character's speed, you just need to factor the character's GetMoveSpeed() when it's used in the SetDesired() function.

    i.e. replace:

    desiredOffset.x += Vector3.Dot (TargetForward, transform.right) * directionInfluence.x;
    

    with e.g.:

    desiredOffset.x += Vector3.Dot (TargetForward, transform.right) * ((KickStarter.player.GetMoveSpeed () + 1f) * directionInfluence.x);
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.