Announcement

Collapse
No announcement yet.

Attach Object to Player with offset

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Attach Object to Player with offset

    Hello! I have an object that I would like the player to pick up and have it float in front of his camera. Not like a physics gun kind of thing. I just want the object to follow the player's camera or just the rotation of the player. I've concluded that the attach actor to actor function is the answer but I'm not entirely sure what to do other than that. When I check "Snap to Target" on the node. The object attaches to the player properly but appears inside the character instead of in front. My character is not a skeletal mesh so I cannot attach the object to any socket. Any idea on how to do this would be greatly appreciated. Thanks.

    #2
    You could just set the floating object's location to the forward vector + your offset.
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    Comment


      #3
      Do I have offset+forward vector and then an add actor relative location node?

      Comment


        #4
        I'm not sure, haven't done something like this before, there is node to get a certain location that is however many units in front of any location.
        Marketplace Assets

        Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
        Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
        Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

        Comment


          #5
          I could use Snap To Target on the Attach Actor to Actor node and then add the forward vector + Offset to the targets location. I'll try to test it as soon as I get the chance.

          Comment


            #6
            Yes but adding the offset wont work, because the offset will be different depending on what direction the player is facing, what I mean was the there is a node that will get the character's rotation and the offset and convert it, then you can add the return node to your forward vector. If my computer stops having troubles, I will try and find what node that is and post back here.
            Last edited by Jamendxman3; 05-27-2015, 09:24 PM.
            Marketplace Assets

            Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
            Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
            Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

            Comment


              #7
              Hello,
              You can create an empty component (empty static mesh) attached to camera and set at right location. When nothing, you set it empty, when you have an item, you fill it with the static mesh. If location is not the same for all items, you can create an array of transforms (locations rotations) for each type of item wield.

              Comment


                #8
                Okay. So I could make a Charcter BP variable and make it public and set that variable to my character controller script. I could then from my object BP access that empty and move the object to that empty. Okay! That makes sense. Thanks!

                Comment


                  #9
                  Got it! Click image for larger version

Name:	Screenshot (58).png
Views:	1
Size:	143.8 KB
ID:	1079040Click image for larger version

Name:	Screenshot (59).png
Views:	1
Size:	558.4 KB
ID:	1079041 Thanks a ton!

                  Comment


                    #10
                    Originally posted by Jamendxman3 View Post
                    Yes but adding the offset wont work, because the offset will be different depending on what direction the player is facing, what I mean was the there is a node that will get the character's rotation and the offset and convert it, then you can add the return node to your forward vector. If my computer stops having troubles, I will try and find what node that is and post back here.
                    I know this is old and I'm reviving a solved post, but do you know the name of this node?

                    I have two camera aligned text renders attached to an object, but I would like to offset one text render to right. The problem is when you rotate the camera around to the other side the text ends up on the left.

                    Comment

                    Working...
                    X