Forum rules - please read before posting.

Stop NPC facing player direction when following

It seems to be set as default that the when the NPC is triggered to Follow Player they turn constantly to face the player as they follow. I don't want them to rotate always. How can I disable this?

Comments

  • Also as an alternative how do I stop the npc getting stuck on walls when turning?

  • It seems to be set as default that the when the NPC is triggered to Follow Player they turn constantly to face the player as they follow.

    Uncheck Face when idle? in the Character: NPC follow Action.

    how do I stop the npc getting stuck on walls when turning?

    I'm not clear about what you mean here. Please share more screenshots and details to illustrate the situation.

  • Sorry for the very vague description of the wall issue, I was tired when I wrote it.

    I am prototyping and am new to Characters, npcs and npc movement in AC. I'll describe my current setup. I have a 2D Character (npc), in a 3D scene. They are a flat Sprite standing upright with a box collider around them. (Doom-like if Doom environments were true 3D)

    Their relevant components are as follows:
    Sprite Renderer
    Box Collider
    Moveable
    Paths
    NPC
    Rigidboody

    They have a long trigger box attached which extends in front of them. When the player enters the trigger the following is run:

    The outcome is they follow the player but also turn to continually to face the player, whilst moving and often collide with the walls (walls have collision boxes) of the corridor they are in and slow down or get stuck:

    At this point I would like to know how to:
    1. stop them turning at all and just trigger them to follow the player without turning, and just move in a straight line (along 1 axis) I suppose.
    2. If I do want them turning, I don't want them getting stuck in walls etc...

    Thanks very much.

  • You're using sprite-based characters, but haven't assigned a sprite-child, and also have Turn root object in 3D? checked. When the character moves, he turns to face whatever direction he's in.

    Try unchecking this option, and move the sprite to a child so that you can update this direction to whatever you need (through scripting, if necessary)

    As for getting stuck on walls, that's down to your use of box colliders against box colliders. Replace with a rounded capsule collider, or both the collider + rigibody for a Character Controller, and you should have better results.

  • Thanks Chris. So I Added a child game-object to the npc and put the Sprite as a component there instead of the parent. I unchecked Turn root object in 3D?. so this is the situation now:

    The NPC is facing down the corridor with his trigger infront of him.

    When the player approaches the npc and activates the trigger, the npc now turns 90 degrees on the spot and does not follow the player.

    I think the turn of 90 degrees stops the follow command being activated.

    Any idea how to stop this sudden turn occurring?

  • Likely not without seeing things for myself.

    If you can reduce the issue into a .unitypackage of:

    • Manager assets
    • Scene file
    • Player / NPC prefabs
    • Character graphics

    PM it to me and I'll take a look.

  • Done. Thanks Chris.

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.