79523143

Date: 2025-03-20 13:48:45
Score: 0.5
Natty:
Report link

Assuming that:

This becomes a pretty easy math problem. Direction isn't really relevant in that case.

public float reductionFactor = -20;
public Vector2 origin;

void Update()
{
    Vector2 target = GetIntersectionWithCameraBounds(follow);
    // scale the percentage to 0-1 and then look for our target size
    // (e.g. a 20% reduction means we want to be 0.8 of our original)
    float targetRatio = (100.0 - reductionFactor) / 100.0; 

    Vector2 reducedTarget = new Vector2(target.X * targetRatio, target.Y * targetRatio);
}

If you are using Unity or some framework, there may be built in ways to handle that type of transformation.

Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Jeremy Richards