Keeping an NPC character in front of a player character.
I an experimenting with games in which non player characters will block the player from time to time. I am using C# with a limited base of experience, though I am not entirely new to it. What I am stuck on is that as the player turns I want to npc to shuffle in front of him/her, remaining in the view, in essence blocking the way. This problem seems to be a bit beyond me at the moment. One thing that I have tried is creating a parented point in front of the player which the npc will MoveTowards, which created issues with the object following the point on all axis. I have also been experimenting with the transform and transform.forward. One thing that I have been playing with is along the lines of:
public Transform player;
public Transform target;
private void Update()
{
target.transform.position = player.transform.forward;
}
}
Any suggestions or examples would be welcome.
When you say the NPC is following the point on each axis, do you mean the NPC is following the point on the y axis as well? So if the player looks up, the NPC goes up to follow the point?
Your answer
Follow this Question
Related Questions
Character shop 1 Answer
Add 2D Skeleton to the Scene if Button was pressed 0 Answers
Character Selection 0 Answers