Canvas to switch characters at runtime

Forums 💬 FlowCanvas ⚙️ Support Canvas to switch characters at runtime

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #22552
    dharry
    Participant

      Hi All,

      I am trying to work out a canvas to switch my playable character during the game. I have 2 main characters and what I want to do is switch characters at the press of a key, so 1 for char 1 and 2 for char 2 etc…

      Obviously they need to keep the same position, rotation etc… I was thinking it might be as easy as just turning on and off renderers perhaps?

      Any thoughts on this, or has anyone done it?

      Thanks
      Dean

      #22557
      chocolacode
      Participant

        Hi Dean,

        I think that would depend on
        The complexity of your game. If
        They switch just appearance your
        Approach would be sufficient, I
        Believe. However If your characters have
        Already some properties, i.e. Power,
        Health, color, height, etc that you want to persist, you might
        Want to move them as well at switch
        Time?

        #22556
        dharry
        Participant

          Hi Chocolade, thinking about it I don’t think my approach would be enough… perhaps a better way would be to copy components with values from one object to the other.

          So i’m thinking, start with an object of each character, hide all but the start character then on the switch, copy the transform values and then all of it’s child components except for the renderer, enable the new and disable the old. Seems to work in my head, now how to put that in a canvas…

          Dean

          #22555
          chocolacode
          Participant

            Hi Dean,

            I would do a little bit different.
            a) create a Main Character as parent with only a transform component
            b) create a child game object attached to it with the other components, renderer, rigid body, etc
            c) do the same for all characters, so they will have a parent and one child
            d) Create a flow canvas with an input method for specific keyboard keys
            e) at time of switch copy the complete child from one of the characters and set his parent as the Main character, then detach the child from the Main character

            Cheers

            #22554
            dharry
            Participant

              Thanks Chocolacode… you gave me some good ideas and i’m on the right track now I think 🙂

              Cheers
              Dean

              #22553
              chocolacode
              Participant

                nice we can collaborate to each other projects 🙂

                Cheers!

              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.