MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / OnPossessClicked

Method OnPossessClicked

Source/URLab/Private/UI/MjSimulateWidget.cpp:1496–1541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1494}
1495
1496void UMjSimulateWidget::OnPossessClicked()
1497{
1498 if (!SelectedArticulation)
1499 return;
1500
1501 APlayerController* PC = GetOwningPlayer();
1502 if (!PC)
1503 return;
1504
1505 if (!bIsPossessing)
1506 {
1507 OriginalPawn = PC->GetPawn();
1508 PC->Possess(SelectedArticulation);
1509 bIsPossessing = true;
1510
1511 if (PossessButton)
1512 {
1513 if (UTextBlock* BtnText = Cast<UTextBlock>(PossessButton->GetChildAt(0)))
1514 {
1515 BtnText->SetText(FText::FromString(TEXT("Release")));
1516 }
1517 }
1518
1519 UE_LOG(LogURLab, Log, TEXT("Possessed articulation: %s"), *SelectedArticulation->GetName());
1520 }
1521 else
1522 {
1523 PC->UnPossess();
1524 if (OriginalPawn)
1525 {
1526 PC->Possess(OriginalPawn);
1527 }
1528 bIsPossessing = false;
1529 OriginalPawn = nullptr;
1530
1531 if (PossessButton)
1532 {
1533 if (UTextBlock* BtnText = Cast<UTextBlock>(PossessButton->GetChildAt(0)))
1534 {
1535 BtnText->SetText(FText::FromString(TEXT("Possess")));
1536 }
1537 }
1538
1539 UE_LOG(LogURLab, Log, TEXT("Released articulation"));
1540 }
1541}
1542
1543void UMjSimulateWidget::HandleTwistOptionChanged(float NewValue, const FString& OptionName)
1544{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected