`

multiple physics handles unreal editor crashed solution

阅读更多

I'm trying to grab multiple objects with double hands.but when it build over crashed with no build error show on output IDE. leave it here in case somebody has the same issue.

 

 

        RightPhysicsHandler = CreateDefaultSubobject<UPhysicsHandleComponent>(TEXT("AlienPhysicsHandle"));
	RightPhysicsHandler->SetActive(false);
	LeftPhysicsHandler = CreateDefaultSubobject<UPhysicsHandleComponent>(TEXT("AlienPhysicsHandle"));
	LeftPhysicsHandler->SetActive(false);

 

        // update physic handle position
	if (RightPhysicsHandler && RightPhysicsHandler->IsActive())
	{
		FVector Loc = GetMesh()->GetSocketLocation("RightPickupPivot")/* + GetActorForwardVector()*/;
		RightPhysicsHandler->SetTargetLocation(Loc);
	}
	if (LeftPhysicsHandler && LeftPhysicsHandler->IsActive())
	{
		FVector Loc = GetMesh()->GetSocketLocation("LeftPickupPivot")/* + GetActorForwardVector()*/;
		LeftPhysicsHandler->SetTargetLocation(Loc);
	}

 

        //get grab pivot
	if (IsLeftHand && AlienCharacter->LeftPhysicsHandler)
	{
		AlienCharacter->LeftPhysicsHandler->SetActive(true);
		AlienCharacter->LeftPhysicsHandler->GrabComponentAtLocation(CurrentDriverObject.DriveObjectStaticMesh, NAME_None, player->GetMesh()->GetSocketLocation("LeftPickupPivot"));
	}
	else if(!IsLeftHand && AlienCharacter->RightPhysicsHandler)
	{
		AlienCharacter->RightPhysicsHandler->SetActive(true);
		AlienCharacter->RightPhysicsHandler->GrabComponentAtLocation(CurrentDriverObject.DriveObjectStaticMesh, NAME_None, player->GetMesh()->GetSocketLocation("RightPickupPivot"));
	}

 

i didn't set different names in the Text area, Pointer update the PhysicsHandle cannot know which one was execute, fixed bellow:

 

        RightPhysicsHandler = CreateDefaultSubobject<UPhysicsHandleComponent>(TEXT("AlienLeftPhysicsHandle"));
	RightPhysicsHandler->SetActive(false);
	LeftPhysicsHandler = CreateDefaultSubobject<UPhysicsHandleComponent>(TEXT("AlienRightPhysicsHandle"));
	LeftPhysicsHandler->SetActive(false);

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics