x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Attach to Actor Component not working?

I have a very simple blueprint for a "torch" that I want my character to be able to pick up by running over it. alt text

When the player runs over it, it should be attaching to a custom component that I added to my character blueprint. The RightObject component is what the torch should be getting attached to. In the torch blueprint it pulls the root component of the character which is the CapsuleComponent. Index 2 is pulled from that to get the Camera, then it pulls the component from the camera before initiating the attachment.

alt text

The problem is, it doesn't attach to that component. It decides to attach itself to the camera or on top of the camera for some reason, even though the RightObject component has a heck of an offset in front of the camera.

I will post the next two images in a coupe of comments since posts are restricted to 2 attachments.

Product Version: Not Selected
Tags:
more ▼

asked Aug 09 '14 at 06:29 AM in Blueprint Scripting

avatar image

KhorelisSylvari
20 4 6 9

avatar image KhorelisSylvari Aug 09 '14 at 06:32 AM

The component offset is here.

alt text

Anyone have any ideas as to why this is? I'm using the first person template so there is no skeletal mesh or bones/sockets to attach to as I have removed the default arms with the gun since I won't be using that for the final game. Does something like this require sockets? That would seem a bit silly if you have a first person game that doesn't use anything like hands or arm meshes. Is there a way to add sockets without having a skeletal mesh assigned to the mesh component if they are required to accomplish this?

avatar image KhorelisSylvari Aug 09 '14 at 06:34 AM

This is the final result in-game when I run over the torch:

alt text

I had to crop the screenshot so I could post it, lol. As you can see the torch is not positioned way in front of the camera like it should be, but instead it's attached on top of the camera.

avatar image KhorelisSylvari Aug 09 '14 at 06:45 AM

Whoops. There was a small error in the blueprint. The second Get Child Component should have had an Index of 0. I forgot to change it back after trying some different things. Problem still persists though.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Is there a reason you are using Get Child Component nodes instead of just getting a direct pointer to RightObject? You should be able to just "Get Right Object" from the cast-to.

You need to verify that your InParent is valid or it will attach to the root i think so it could be the problem. Maybe do a print string to verify what you are passing in?

more ▼

answered Aug 09 '14 at 06:23 PM

avatar image

RimmyD
2.6k 98 15 96

avatar image KhorelisSylvari Aug 09 '14 at 07:57 PM

Sigh (facepalm) not sure why I didn't think of that. All good though. I wasn't aware you could pull a component directly from a cast. Works great! Sometimes the smallest things provide the best results. I was just over complicating it. Thanks much!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question