How to replicate this NPCs movement

How could I recreate specifically the movement of this goalkeeper NPC? I can’t figure out how they did it in this game. It moves in almost like a semi-circle path around the front side of the goal and stops on each side while constantly facing the hockey puck part.

I think CFrame.lookat() might be useful for having the goalie constantly look at the hockey puck but moving from side to side like in the video above. I have no idea how to go about that.

Game link:

3 Likes

Yes. Use CFrame.LookAt() and then get the orientation of the part that is looking at the puck and transform it to that orientation. You will need to limit how far the goalie rotates aswell. It depends how you code it, but generally you don’t want the goalie moving more than 180, because that is the angle of a line.

I’m still kind of stumped on how to go about this

I got an idea of maybe using an invisible rope attached to the goalie and the center of the goal and have the goalie’s velocity be set to move towards the puck but be limited by the length of the rope. Not too sure yet though.