With this code in my grabber component’s tick:
// Called every frame
void UCOMP_REALGRABBER::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
if (!MyPawn || !MyPhysicsHandle)
{
return;
}
else
{
if (HasHit)
{
GrabberHold_Location = GrabberLocation_Begin + GetForwardVector() * GrabberHoldDistance;
MyPhysicsHandle->SetTargetLocationAndRotation(GrabberHold_Location, GetComponentRotation());
UE_LOG(LogTemp, Warning, TEXT("Attempting to hold an object at location:%s and rotation:%s, The physicshandlename:%s is holding actor:%s"),
*GrabberHold_Location.ToCompactString(),
*GetComponentRotation().ToCompactString(),
*MyPhysicsHandle->GetName(),
*MyPhysicsHandle->GetGrabbedComponent()->GetAttachmentRootActor()->GetActorNameOrLabel()
);
}
}
}
I can walk over to the gargoyle and when i try to pick it up, my logfile shows correctly:
LogBlueprintUserMessages: [BP_MyPawn_C_0] Grab - Pressed - Left Mouse Button
LogTemp: Warning: Grabbing Something...
LogTemp: Error: HitActor:SM_Gargoyle_Statue HittingDistance:219.096573 Hitlocation: V(X=683.04, Y=787.48, Z=69.19)
LogTemp: Warning: Attempting to hold an object at location:V(X=663.05, Y=769.51, Z=82.56) and rotation:R(P=-23.45, Y=14.76), The physicshandlename:PhysicsHandle is holding actor:SM_Gargoyle_Statue
and as I walk around the location and rotation changes as expected.
However the gargoyle never moves at all.
I’ve set the gargoyle to ‘movable’ and enabled physics on it.
I’m not sure what else I can try.