Casting To Attach Static Meshes

Can anyone tell me what should go into the object node on the cast, and explain why we do this. It is saying that my static meshes bp file does not inheret from the player_bp which is my main character bp and thats why. It is its own bp so i think it inherets from itself. However getting a reference to self doesnt work either.
I want it to check if the line traced mesh is the alien wrist computer and if it is i want it to attach to a socket on my characters arm.

Thanks.

Plug the Actor Traced into the cast, and get rid of the branch and Equals node. Casting is the check you want. From the docs: "When using a Cast To node in Blueprints, put simply, you are attempting to check if the object you are casting from is the specific object you casted to. "

i tried what you said but doing it that way teleports my main char to the object and ends up messing the camera up and the item doesnt attach.
Somehow the target should be the wrist computer and the parent should be the skeletal mesh. I think ive done it backwards and somehow should do it in the Wrist computer bp

Ah, yeah you’re doing it backwards. Sorry I didn’t catch that. You said it though. Alien_WristComputer_BP should go into the target pin of the AttachActorToComponent node, and then plug your character’s skeletal mesh into the parent pin.

If you want a system where you have one “Interact” key that activates custom behavior on whatever object is in front of your character, check out blueprint interfaces. They’re basically designed just for that.

yea i think im going to have to do it another way. i cant get it working at all. The only way i can get it working is by event overlap with the collision. Cant get the item traced to recognise it and attach it.

Even this doesnt work

Neither does using the get collision for it. I see the blueprint interfaces have a bunch of ins and outs. I did make one for my health and stamina but ive forgotten how to use it ill have to read up on it again.

Got it, getting a reference to self and seeing if its equal to the traced item works. using the actual actor bp in the drop box for it does not.

One more thing though if u dont mind. What would be a better way to check for it. Because i heard event tick is not the best way to do alot of stuff. Im going to make the player craft the item and then pick it up and this will only happen once at the start of the game.

Thanks

Comparing two variables every tick is no problem at all, especially if you’re only going to have one of these objects. One thing you can do is move the cast to Player_BP to BeginPlay and store the reference as a variable. Unless your player character is going to change there’s no reason to cast to it more than once. But even with the cast, that’s only two little functions, not nearly enough to hit your performance.