I’ve created a socket on a mesh I’m using as a special door. I want to get the location of this socket so I can do some maths and make a nice rotation and translation effect. I’ve gone about attempting to get the socket in the following manner but it crashes Unreal soon as it is called:
void UDoorRotator::OpenDoorByAxialRotation() {
USkeletalMeshComponent* DoorMesh = nullptr;
DoorMesh = Door->FindComponentByClass<USkeletalMeshComponent>();
FVector DoorPivotPoint = DoorMesh->GetSocketByName("PivotPoint")->GetSocketLocation(DoorMesh);
UE_LOG(LogTemp, Warning, TEXT("DoorMesh: %s, DoorSocket: %s, DoorPivotPointLocation: %s"), *DoorMesh->GetName(), *DoorMesh->GetSocketByName("PivotPoint")->GetName(), *DoorPivotPoint.ToString())
}
It could be that I have some dangling pointers in the UE_LOG since I’m not checking if they are null or not. It could also be GetSocketLoction(DoorMesh) since I was not sure what to pass into that method. I don’t understand why I need to pass anything in since I already have the socket but it craps out if I do not give it a reference parameter.