Forum rules - please read before posting.

Adding component Movement Node to GameObject

Unity: 2019.3.9f1
AC: v1.70.4

Maybe I've misunderstood but Movement Node does not seem to be an available component to add to an empty GameObject. Are Nodes a separate import and not with the main AC package?

I tried out the Node template package but thought that was just a demonstration, are the prefabs included there what I should import into my main game project in order to use nodes?

Thanks as always.

Comments

  • They are a separate add-on - the package provides both their functionality (scripts + prefabs) as well as the example scenes to demonstrate their usage.

  • edited April 2020

    So I should import the nodes package into my main game project. Should I still do the assign managers part of the installation instructions, or will that mess with my game?

  • It will mess with your game unless you're just starting. The safest way to make use of it is to copy/paste each of its Menus into your own Menu Manager. The others should be OK to leave alone.

  • Are its Menus needed for the Node Scripts to be available as components and run under ActionLists, or can I start creating my own Node based movements without them after just a simple import of the package?

  • It's all intended as a demonstration - it's expected that you'd want use it as a basis for your own system.

    The menus are necessary for the default "First person" scene to work, since the custom scripts refer to them. But the scripts themselves can be modified to suit your needs.

  • Thanks I'll have a play around.

  • I have some questions:

    1. Does a character need to be moved to a Node before being able to traverse a Node path to a Linked Node using an Action like Move Forward?

    2. Is there a component I can add to a character to set its starting Node, or must that be set in an ActionList using OnStart using Move to Specific Node with Instant ticked?

    3. I have a Trigger which runs an actionlist with Character: Movement Node: Move Forward. When the player triggers this the character moves forward to the next node. I have another trigger with Character: Movement Node: Move Backward, this seems to not move the character at all. However Triggering Move Forward again makes the character trun 180 and move back to the starting node. What is going on here and how can I make the Character Reverse when triggering the Move Backward action?

    4. When moving between Nodes I expected the movement to be precise and stick to the link line very carefully. Instead the Character moves between Nodes but doesn't stick to the line precisely and follows it in a more approxamated manner, especially when turning. It's like they walk in a circle instead of turning on the spot. How can I tidy this up?

    Thanks.

  • Does a character need to be moved to a Node before being able to traverse a Node path to a Linked Node using an Action like Move Forward?

    If they aren't starting from a Node then they won't pathfind along a Node path - they'll just move directly to the final Node.

    Is there a component I can add to a character to set its starting Node, or must that be set in an ActionList using OnStart using Move to Specific Node with Instant ticked?

    For Players, you can associated a node with a PlayerStart.

    For NPCs, such a component be simple:

    using UnityEngine;
    
    namespace AC.MovementNodes
    {
    
        public class SetStartingNode : MonoBehaviour
        {
    
            public MovementNode node;
    
            void Start ()
            {
                node.SnapTo (GetComponent <Char>());
            }
    
        }
    
    }
    

    I have a Trigger which runs an actionlist with Character: Movement Node: Move Forward. When the player triggers this the character moves forward to the next node. I have another trigger with Character: Movement Node: Move Backward, this seems to not move the character at all. However Triggering Move Forward again makes the character trun 180 and move back to the starting node. What is going on here and how can I make the Character Reverse when triggering the Move Backward action?

    It sounds like the character is facing back towards the node. If you're using sprites in 3D space it may be that they aren't facing the direction they appear to be. Try using a 3D character to test which way they're really facing. Bear in mind that you'll need at least two directions on the node - since the character has to face one of them upon reaching it. If you only have one direction facing the other node, the character will automatically face to that direction (so that going "forward" will go back to it).

    When moving between Nodes I expected the movement to be precise and stick to the link line very carefully. Instead the Character moves between Nodes but doesn't stick to the line precisely and follows it in a more approxamated manner, especially when turning. It's like they walk in a circle instead of turning on the spot. How can I tidy this up?

    Node paths are the same as any Path object, and character motion still obeys the usual settings. See the Manual's "Precision movement" chapter for details.

  • It sounds like the character is facing back towards the node. If you're using sprites in 3D space it may be that they aren't facing the direction they appear to be. Try using a 3D character to test which way they're really facing. Bear in mind that you'll need at least two directions on the node - since the character has to face one of them upon reaching it. If you only have one direction facing the other node, the character will automatically face to that direction (so that going "forward" will go back to it).

    The Sprite is not facing backwards. I have checked with a 3D Object attached. Move Backward action just won't do anything after the Character has moved forwards along that very path. What could be preventing Move Backwards action? Anything in NPC settings or Paths component options on the Nodes? Something else?

    Thanks.

  • After triggering said Forward Movement and whilst still in-game the Movement Node Inspector looks like this:

    Is it relevant that only the forward button is available?

  • Yes, and it also looks like you've only got one direction defined.

    A character will always face along one of the node's directions when standing over one, so if there's only one direction - they'll always face in that direction. Is "Node A" going back to where they came from?

  • edited May 2020

    Yes it is. So when the NPC arrives at Node B (from Node A) they stop, facing away from Node A.

    -On triggering Move Forward, they turn 180 and move toward Node A.

    OR

    -On triggering Move Backward, nothing happens.

    I want the NPC to go in reverse on triggering Move Backward.

  • So make another node that faces in the opposite direction, so that they face it when moving there.

  • edited May 2020

    I'm not sure at this point if we are misunderstanding each other completely. What you are suggesting sounds the opposite of what i want. Maybe I am misunderstanding?

    I want them to face away from Node A when they get to Node B (as they currently are), I just want them to reverse back to Node A (without turning) when triggering Move Backwards. They currently do not respond to Move Backwards.

    Simply put:

    On triggering Move Backwards action I want the NPC to move in the direction opposite of that which they are facing and to not turn as they move. To reverse.
    However, on triggering Move Backwards, nothing happens.

  • That's all as I understood it.

    For a character to have a concept of "backward", they need to be on a node with at least two directions. The one you've shown only has one.

    Be aware that as a downloadable package, it's all open to be changed to suit your needs. This is just the provided behaviour.

  • Ok, we're getting somewhere then. So In order for Move Backwards to work I have to add another Direction on the same node pointing the way back in the Spin angle. Move Backwards now responds, however it exibits the same behaviour as Move Forwards: the NPC turns 180 and walks back.

    Is the 180 turn on Move Backwards part of the way Nodes is programmed or is it an option within the NPC component, and if so, which one?

    Thanks.

  • edited May 2020

    The character will turn 180 and move back in that direction if you tell them to move backwards.

    Make sure your two directions are facing in opposite directions.

    All node behaviour is handled in the MovementNode script. Moving backwards is handled by its MoveBackward function.

    If you want the character to face the opposite way (i.e. literally walking backwards) you can set their sprite child's rotation in LateUpdate to whatever you wish.

  • edited May 2020

    If you want the character to face the opposite way (i.e. literally walking backwards) you can set their sprite child's rotation in LateUpdate to whatever you wish.

    Where do I find this bit of script to edit? I've used Find in MovementNode script but LiveUpdate is not there.

  • I'm not talking about editing that script. I'm saying you could add that to a script of your own.

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.