So this one is simple to explain, just think of pokemon let’s go and how the first pokemon in the player’s team follows the path they take in the world. So they stay right behind the player but if the player turns right, the pokemon moves to the point the player was before they turn right and then does the same turn. Having the object move towards the player because if an object comes between them it will get stuck.
Any idea what kind of technique I would use to program this?
It’s probably just a simple List and you add a point every n distance traversed.
Then it’s just a matter of pointing your npc to the point you want in that list…
I see, but wouldn’t the list have to be update each second so the npc would know the player objects current coordinates?
As said I wouldn’t use time as a measurement of when to add a new point because what if the character just stands there… Then you don’t know what point to choose for your npc. You also have to decide how long the list is going to get. When you add a new point just remove the oldest one etc.
Is it possible to make the coordinate they npc should move to one that is relative the to personal space of the player. like to move behind them?
Well of course, behind the player is just “playerTransform.position - playerTransform.forward * whateverDistanceYouNeed”. If you just point to that you’ll have the going around corners problem again. It’s better to make the trail of points and for example always point to the 5th in the list. What fits depends on how much distance is between the points…
I have tried to do some research on how to do what you suggested and I still have no idea how to go about it. Could you give me some more details?