So I’m using the unity rollerball prefab and want an object to follow right behind it no matter which way it goes. For example: if the ball is going north/up, the object would be behind/ down, relative to the ball. If I’m going up and left the object would be down and right in comparison to the ball. I tried using,
public Vector3 offset;
public Rigidbody player;
public float distance;
public GameObject trigger;
void Update () {
offset = -player.velocity * distance;
trigger.transform.position = player.transform.position + offset;
}
This gets the right effect, but because it is based on velocity, the faster the ball goes the farther the object lags behind. Also if the object stops moving then the object just appears inside the ball because the velocity is 0. Any suggestions how I could make this work? Anything is appreciated. I guess i’m trying to make a game similar to the Mario party game where you try to pop the balloon on the back of a go-kart where the balloon is always behind the kart.