LeiaTargetFocus

The LeiaTargetFocus component takes a target GameObject as a parameter and will keep that object in focus based on it's mesh vertices.

Pros

  • Makes it easy to always keep a desired target game object in focus.

  • Doesn't require using shaders which write to the depth buffer (unlike LeiaDepthFocus).

  • Doesn't require setting up colliders in your scene (unlike LeiaRaycastFocus).

Cons

  • Tradeoff between accuracy and performance depending on how many samples are taken.

  • More samples yields better accuracy but reduced performance.

  • Less samples yields less accuracy but better performance.

Unique Parameters:

  • Samples

    • How many mesh vertices to take as sample points for determining depth factor and focal distance. Larger sample count will be more costly performance-wise.

  • Target

    • The target game object to focus on. Child objects of the target game object will also be taken into account in the auto focus algorithm.