I’m making a 2D shooter with power ups and I’m trying to figure out a way to make the power up move faster towards the player when the player gets closer.
I tried messing around with lerps, but it doesn’t seem to be working. The following object keeps slowing down when it gets closer. I’m looking for the opposite of that…
Is there another method I’m missing?
showing your code would help if you have the opposite thing working you should be able to reverse it… but I don’t know how you are doing things so I’ll tell you how I would do it.
float distanceToActivate=10f;
float distanceBetweenPlayerAndPickUp=Vector2.Distance(player.transform.position,pickup.transform.position);
float pickUpSpeed;
if(distanceBetweenPlayerAndPickUp<distanceToActivate)
{
pickUpSpeed=distanceToActivate-distanceBetweenPlayerAndPickUp;
//move pickUp towards player based on pickUpSpeed, moveTowards or whatever
}