I’m a newbie and have been stuck on a sticky ball mechanic for my soccer game for quite some time now (weeks in fact!).
When a players’ character gains possession of a ball I want this ball to be nudged forward when the player moves but also change direction along with the player unless the ball is no longer within the control distance.
So far I’ve been able to nudge the ball forward in the players’ direction by settings its’ velocity equal to the players’ forward vector multiplied by a desired value. I then set a high drag force in the balls’ opposite direction to slow the ball quickly. If the player stops moving the ball will move out of his control range. This works just about how I would like.
However; when the player changes direction I can’t get the ball to change perfectly in front of him. It’s difficult to explain the effect so please check out the video demo.
I realise I could just set the balls’ world location to 50 units in front of the player but I want the nudging effect.
The logic for the below blueprint works like this:
if ball is greater than 250 from player feet set InPossesion to false
else
if ball is less then or equal to 50 then nudge ball forward
else
rotate the ball to players direction while in mid-nudge
It’s the last line than doesn’t work at intended.