How to attach an object to character

Hello,

I would like to attach an object (child actor) to a character (parent actor)

(drag the object on the Character in the World Outliner)

and not the inverse like the AttachToComponent do

(drag the Character on the object in the World Outliner).

:slight_smile: hey …in your Character actor BP, add a Child Actor Component, then in this component nominate your object

And how can I get the mesh of the child actor, it’s located to another blueprint.

I tried to cast to the blueprint, but it miss the object input that I don’t know what is it.

drag the new Child Actor Component into your BP
using this as a reference, with “context sensitive” turned on, you’ll be able to access the Mesh Component of your Child actor

it say Static Mesh Component Object Reference is not compatible with Actor Object Reference.

mmm… you might need to cast from your child actor reference to your specific actor type, then get the reference to the Static Mesh Component

ok now I am lost, I don’t know how to use cast function :smiley:

ah, I missed out a step… it goes like this… turn on “context sensitive” to find the right nodes more easily

reference to Child Actor Component > Get Child Component > Cast to MyObjectBP > Get Static Mesh

here’s how it should look … referencing your object in the cast

Is this blueprint is the object or the actor ?

this is in the parent actor…

And I see that you used an actor for the object, while I used a simple static mesh creator.

is it a problem ?

ummm… it might be… an actor (with a static mesh component) is the usual way to put a static mesh in the game world

(sorry, I’m not sure what a static mesh creator is)

… it’s late here, so I’m logging out for the night… let me know how progress goes and I’ll check the thread in the morning :slight_smile:

Is what you described is intend to spawn the object when press play button ?

the object is likely to be an actor class… (most visible things are actors in the gameworld)

when you launch PIE (play in editor) session, a child actor will be automatically attached to your character actor… because you set the Child Actor Component in the parent actor

It’s the result that I have, yes.

But the problem is that I don’t want it, I want acting like in VR, give the possibility to grab environment object with my character.

Good night else :stuck_out_tongue:

Finally I resolved the problem with MoveComponentTo().

Ok thanks I will watch it, but now I am stuck with the problem of set location, unlike the parent/child way that set the location and rotate when the character rotate, the other way don’t do that, it only set the location :confused:

ah… I understand better what you are doing… you have a character actor and a pick up actor

completely ignore my advice (a Parent / Child relationship usually serves a different purpose than a pickup)… as for MoveComponentTo… it might appear to give you the results you are looking for… but I’m not sure it’s the best approach.

I’m sure there are a bunch of VR (and non-VR) pick up tutorials on YouTube… I’d check these out and I think you’ll find a straightforward solution there