logo hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    How to make trail effect?

    Scheduled Pinned Locked Moved
    Help and Support
    4
    7
    259
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Wazk MobileW
      Wazk Mobile
      last edited by

      I’m wondering how to make objects follow each other with the function to add and subtract objects(making a trail like slither.io)

      1 Reply Last reply Reply Quote 0
      • GameCRAZYG
        GameCRAZY
        last edited by

        For each time an object moves another object can move the same amount of units up, down, left, or right?

        1 Reply Last reply Reply Quote 0
        • Wazk MobileW
          Wazk Mobile
          last edited by

          Yeah but how do I make it so I can add more in game.

          1 Reply Last reply Reply Quote 0
          • GameCRAZYG
            GameCRAZY
            last edited by

            What do you mean?

            Just put all the regular behaviors, and when you do something to move the object or set a velocity or whatever, tag the object and the objects that are following it to move together.

            Jack8680J 1 Reply Last reply Reply Quote 0
            • Jack8680J
              Jack8680 @GameCRAZY
              last edited by

              @GameCRAZY that wouldn't make a trail, they'd all move the same way. The easiest way I think is to use an array the length of the trail, every time the main object moves add its position to the front of the array and delete the last one. Start the array with the starting positions of the trail. Whenever you move, each part of the trail moves to the relevant part of the array.

              1 Reply Last reply Reply Quote 0
              • D
                Deeeds
                last edited by

                Pivot Joints.

                Head (first circle) has a pivot joint some percentage from its centre towards the direction of the tail. Place the pivot joint here, attach the tail circle at this point, to its centre. Each subsequent tail section attaches to its "parent" at a point on the parent the same distance from the centre that was used on the head, in the opposite direction to that of the current movement.

                Some maths required to figure out where that is, math that is far beyond me.

                1 Reply Last reply Reply Quote 0
                • D
                  Deeeds
                  last edited by

                  Here's an image describing the offset of the initial anchor point on the head, each subsequent tail section has its own anchor point moved the same distance in the corresponding inverse direction of travel:

                  0_1509355788351_Image-1.jpg

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post