Forum rules - please read before posting.

NPCs changing face direction on mouse movement around player

Hey everybody,
hey @ChrisIceBox!

I have a weird issue. My sprite NPCs are switching facing direction when I move the mouse around my player character. So when I move the mouse to the right of my player, the NPCs suddenly turn to the left.

I think this problem was there from the start and I haven't looked into it for long, but I was wondering if anybody has encountered this behavior and can tell me what to do about it :)

Thanks!

Unity: 2022.3.19
AC: 1.81.6

Comments

  • The two aspects should be completely independent. Do you have any custom scripts in use that may affect things?

    Does your camera have Follow cursor? checked, and - if so - does the issue remain if it is unchecked?

    Is it specifically the position relative to the Player, or the cursor's position on-screen? Try removing your Player and see if it still occurs.

    Does this occur with all NPCs, including newly-made ones? Assuming this is a 2D game, try dropping in the 2D Demo's Player character, Brain2D, and use the Inspector's cog menu to convert him into an NPC. Does he then show the same behaviour?

  • Thank you Chris! The issue is indeed solved when I uncheck "Follow cursor?" on my game camera. It doesn't matter where the player is positioned, it's relative to the player. It occurs with all NPCs and it's a 3D game with sprite NPCs.

    My NPC settings:
    Facing Directions: Custom
    Left? true
    Right? true
    Frame Flipping: Left Mirrors Right
    Flip Custom Animations: true

    Turn Root Object in 3D: true
    Retro-Style movement: true

    I'll keep looking if I missed custom code from a time long ago that I forgot about (I experimented with camera-flipping so that is the next place I'll be having a look-see..)

  • By how much does the cursor affect the camera's rotation? It could be that the change in angle is causing the character to be shown from a side-angle.

    If your NPC only faces left and right, they'll flip between the two whenever the camera's facing direction crosses over the relative direction between them. If they had a downward-facing direction, they may not have this issue.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.