For the game I’m working on I need my character to be able to pick another character (a chuck).
A Chuck is like a chicken…
Now what I want to do is this.
In the chuck character blueprint I want to handle the “pick up”
When picked up he should be upside down and snapped to something in the player character.
So I figure I need 2 sockets, one at the chuck’s feet and one on lets say the players hand.
Problem 1Would this be the correct way of handling it?
Problem 2How do I add sockets?
[INDENT=2]Under the skeleton asset, right click a bone and select add socket. Use the viewport to then reposition the socket.
[/INDENT]
Problem 3Is there a blue print node which can handle this?
[INDENT=2]Attatch Actor to Component will handle to snapping to component
[/INDENT]
**Problem 4
**[INDENT=2] In the chuck character BP I am declaring CanBePickedUP by means of overlap event. How do I retrieve this boolean in the player character blueprint?
[/INDENT]
[INDENT=3] Dropped this for a different approach
[/INDENT]
Pick Up Nodes using Cast To to retrieve event in Chuck_Character_BP
So I added a Socket to the chucks legs and 1 on each hand of the character.
The chuck now has a box which handles the CanBePickedUp? boolean.
On begin overlap = true
On end overlap = false
I couldn’t seem to handle player input in the AI controlled character (chuck) blueprint.
That being said, I want to do a left mouse event. See if CanBePickedUp = true in some universal way. Use a linetrace or something to figure out what it even is im trying to pick up.
Now if its a chuck, I want to run some sort of grab animation. At which point the chuck will be held upside down in the characters hand.
I have no clue how to make the chuck stick to my right hand socket.
Basically what your doing so far is correct. You could use an overlap event, or a linetrace (which would be better in my opinion) and have it check if the hit actor is the same actor bp as the chuck is, or you could use other methods like object type, actor has tag, ect to determine if the trace hits the chuck or something else.
To get the the chuck to attach to the players socket all you need to do is use the node Attach Component to Component (or actor to actor) and set the component to the players mesh, and its socket to the players hand socket.
I’ve been playing around with the Attach node. But I have a branch going into attach if true. It requires the hit actor to be a chuck BP with CanBePickedUP = true.
So far it’s returning a Null value which I dont understand. It should be returning either true or false…
Anyway, thanks for the pointer. I’ll keep tinkering around see where that gets me.
So apparently it did work when I was fooling around with the AttachActorToActor, I just did it the wrong way around making it unnoticeable.
However I cant seem to use the boolean I set in the Chuck BP to enable or disable individual pickup events in the character blueprint.
Apparently I have no idea how to make blueprints communicate.
So I watched a tutorial on blueprint communication.
Almost exactly what I was trying, but apparently using existing CharacterBlueprints in the variables tab for communication always gets NULL. Unlike the tutorial I watched.
However I managed to replace that with a simple pure cast to.
I removed the booleans I set in the chuck BP and replaced those with a custom event that gets played whenever the character picks up a chuck.
This Event stops all movement from the chuck, turns off gravity and rotates the chuck Upside down.