Trouble With Character Socket/Attaching

Hello, I’m using Unreal Engine 4 and I’m pretty sure I have some misunderstanding somewhere, I’m trying to attach a actor to a socket and it doesn’t work. It half way works, it attaches to root component but not the socket, I tried in C++ then in Blueprint both with no avail. My conclusion in testing is that I have the concept of socket Confused. I created an socket by going to the skeleton and using create socket and reference the name by there. Thanks for the help in advance. Geez=/ usually something so simple becomes a big task and research…
Update: Actually as it seems on this page I have the term socket correct and doing everything the right way. Although the object snaps to the rootcomponent and not the socket
That is my blueprint… see picture https://docs.unrealengine.com/latest/INT/Engine/Content/Types/SkeletalMeshes/Sockets/index.html#blueprintattachment

Attach to Component is the work around, I don’t know if this is a bug or not. I’ll make a video and report later.
Since the documentation does say “at a optionally named socket” on each attach function.

I’m having problems with this as well. Can anyone confirm if this is a bug? I’ve tried with socket name and without. Using 4.17.2 currently.

This is my code (ActorToGrab1 is an AActor):

//FName SocketOnCharacter1 = TEXT("AttachEnemy1");
		USkeletalMeshComponent *MainCharacterMesh = mainCharacterActor->FindComponentByClass<USkeletalMeshComponent>();
		    		
		//ActorToGrab1->AttachRootComponentToActor(mainCharacterActor, "AttachEnemy1", EAttachLocation::SnapToTarget, false);
		ActorToGrab1->AttachToComponent(MainCharacterMesh, FAttachmentTransformRules::SnapToTargetNotIncludingScale, "AttachEnemy1");

You’re using the wrong accessor.

Can you give an example of the proper accessor? Because after further testing, I discovered my current code actually places the character I wish to attach to the other character’s socket at the correct place (once), but then the character simply falls to the ground, and it doesn’t move with my main character at all (i.e. doesn’t stay with the socket location at all).

I’m not sure how to get the “other character” to NOT fall to the ground (it’s a ragdolled character). I want it to attach to the socket, and stay attached.

I’ve tried changing the other ragdolled character’s movement mode to “Flying”, and to “None”. I’ve also tried to make sure the physics collision channels on both actors do not collide. Neither of those worked. Maybe I need to turn off gravity on the ragdolled character somehow?

Here is my current code:
void UMainCharacterController1::AttachActorToFootSocket1()
{
if (ActorToGrab1 != nullptr)
{

	// Set the enemy/actor's movement mode to "None" or to "Flying", so that the ragdoll can freely move
	// with the main character
	UCharacterMovementComponent *MainCharacterMovementComponent1 = ActorToGrab1->FindComponentByClass<UCharacterMovementComponent>();
	MainCharacterMovementComponent1->SetMovementMode(MOVE_Flying);

			
	ActorToGrab1->AttachToActor(mainCharacterActor, FAttachmentTransformRules(EAttachmentRule::SnapToTarget, true), "AttachEnemy1");

	UE_LOG(LogTemp, Warning, TEXT("The AttachActorToFootSocket1 function was run and there IS an Actor!"));
}
else
{
	UE_LOG(LogTemp, Warning, TEXT("The AttachActorToFootSocket1 function was run, but no Actor!"));
}

}

Ok, nevermind. The AttachToActor code is working for me, sorry about that.

It just has something to do with the fact that the character I want to attach is ragdolled and the game won’t let it move off the ground for some reason (maybe physics, maybe movement mode, maybe navigation system, I don’t know). The code and function are working though. Which is good. Thanks.

did you find the reason to that?