I can’t believe it, I’ve had 3 weeks working on this issue, and no one did help me on the AnswerHub and the forums, so im just thinking this is just a bug.
What Im trying to do, is to translate the content example blueprint to grab objects like skyrim or amnesia. But whenever I call a function or modify a variable of the class UPhysicsHandle, the editor crashes.
Here’s the .h
FCollisionQueryParams TraceParams;
UPhysicsHandleComponent* PhysicsHandle;
UPrimitiveComponent* PhysicsObject;
Now the .cpp, the function constructor:
void ACharacter::GrabObject()
{
FHitResult GC_OutHit(ForceInit);
APlayerCameraManager* GPCM = UGameplayStatics::GetPlayerCameraManager(this, 0);
TraceParams.bTraceComplex = true;
TraceParams.AddIgnoredComponent(GetCapsuleComponent());
if (GetWorld()->LineTraceSingle(GC_OutHit,
GPCM->GetCameraLocation(),
GPCM->GetCameraLocation() + (FVector(500.f) * FVector(GPCM->GetCameraRotation().Vector())),
ECollisionChannel::ECC_PhysicsBody,
TraceParams))
{
PH_Active = true;
DrawDebugLine(GetWorld(),
GPCM->GetCameraLocation(),
GPCM->GetCameraLocation() + (FVector(500.f) * FVector(GPCM->GetCameraRotation().Vector())),
FColor::Green,
true,
10.f,
0,
2.f);
PhysicsObject = GC_OutHit.GetComponent();
PhysicsObject->InitializeComponent();
PhysicsHandle->LinearDamping = 200.f;
PhysicsHandle->LinearStiffness = 750.f;
PhysicsHandle->AngularDamping = 500.f;
PhysicsHandle->AngularStiffness = 1500.f;
PhysicsHandle->InterpolationSpeed = 50.f;
PhysicsHandle->GrabComponent(PhysicsObject, GC_OutHit.BoneName, GC_OutHit.Location, true);
PhysicsHandle->SetTargetLocation(GPCM->GetCameraLocation() + (FVector(500.f) * FVector(GPCM->GetCameraRotation().Vector())));
}
else
PH_Active = false;
}
The crash always happens on this line:
PhysicsHandle->GrabComponent(PhysicsObject, GC_OutHit.BoneName, GC_OutHit.Location, true);
But when I remove it, the crash starts on the variable modification (Angles, stifness, damping, etc) Visual Studio don’t tell me what exactly is going wrong, neither the log files.
Im running the editor from source cod, Win 8.1, Engine 4.7.3