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

    Pivot/weld attach to spawned object

    Scheduled Pinned Locked Moved
    Help and Support
    4
    9
    282
    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.
    • bosswaveB
      bosswave
      last edited by bosswave

      My current project includes enemies constantly entering and leaving dark areas. I’m trying to incorporate an upgrade that attaches “markers” onto enemies that can be seen even while they move within the dark areas. Making this work was fairly simple.

      My main issue is that I am not able to find a reliable way to attach the markers to the enemies once the marker is spawned.

      The setup sounds simple:
      -Spawn “marker” on “enemy”
      -pivot attach “spawned object” to “enemy”

      Somehow, it just doesn’t work. I’ve tried other things like:

      Sending the enemy object’s ObjectID to the spawned marker via attributes, then having the marker retrieve the ObjectID from its attributes and running the Pivot Attach logic on their end.

      And simply:

      Marker collides with enemy, marker attaches.

      The last one yields the most success, but only sometimes and is pretty unreliable. Not sure if there’s a much simpler way of handling this that I’m just not seeing.

      Also should mention that enemies are not pre-existing but are instead, themselves, spawned into the world randomly while my level terrain generates.

      1 Reply Last reply Reply Quote 0
      • RobinsonXR
        RobinsonX
        last edited by

        Attaching two objects together requires both of them to be physical. It will not work on Wall or scenery objects.

        1 Reply Last reply Reply Quote 0
        • RobinsonXR
          RobinsonX
          last edited by

          Make sure the marker have absolutely zero mass and resistance, because that can interfere. 👍

          bosswaveB 1 Reply Last reply Reply Quote 0
          • bosswaveB
            bosswave @RobinsonX
            last edited by

            @RobinsonX Thank you, but I kept both of those points in mind lol.

            I have no problem attaching two objects that I manually place in the scene, but I don’t have much luck attaching two spawned objects. Zero mass/resistance on the marker, and it’s a passable physics object.

            SplitMindGamingS 1 Reply Last reply Reply Quote 0
            • SplitMindGamingS
              SplitMindGaming @bosswave
              last edited by

              @bosswave ive had problems with any type of attachments with my game actually. What i would do is the same thing i had success with mine. When u spawn the marker to the object do not setup any type of attach behavior to it. Instead put a timer for every 0 seconds or whatever seconds you choose and have it move to object. This will replicate the weld attach features with way more control.

              bosswaveB 1 Reply Last reply Reply Quote 0
              • RobinsonXR
                RobinsonX
                last edited by

                I use that method too, but I find that laggy. 🤷‍♂️

                1 Reply Last reply Reply Quote 0
                • bosswaveB
                  bosswave @SplitMindGaming
                  last edited by

                  @SplitMindGaming Thank you! I wanted to do this but I’m afraid it would hurt my game’s performance to have 5-9 timers set to 0 seconds constantly going. I appreciate the input!

                  Aidan_FireA 1 Reply Last reply Reply Quote 0
                  • Aidan_FireA
                    Aidan_Fire @bosswave
                    last edited by Aidan_Fire

                    @bosswave Can we have a link to your project to have a go?

                    Not sure if this helps but I did get the basic idea to work in test project: https://bit.ly/2EtLm2n

                    bosswaveB 1 Reply Last reply Reply Quote 0
                    • bosswaveB
                      bosswave @Aidan_Fire
                      last edited by

                      @Aidan_Fire Thanks for sharing! My game logic is, unfortunately, not all in one place. There are a lot of moving parts to my game and so I simply don’t know how I would be able to accomplish that lol. My “spawn marker/attach marker” logic is performed by the spawned enemy objects, but I think I thought of a way to accomplish this thanks to your example.

                      And I would definitely share but my project is pretty large and... well I guess the best way to describe the state of my behaviors would be “organized chaos” lol. Thanks again!

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