Changes / gameloop almost ready

This commit is contained in:
2023-06-18 15:30:11 +02:00
parent a6ce2a73d0
commit 8906b1a492
31 changed files with 13 additions and 29 deletions

View File

@@ -268,19 +268,18 @@ void AFireworksPawn::DisableLaserOnHand(EControllerHand Hand)
if (Hand == EControllerHand::Left)
{
TryShowLaserL = false;
LaserL->SetHiddenInGame(true);
}
else {
TryShowLaserR = false;
LaserR->SetHiddenInGame(true);
}
}
// Update laser visuals and trace
void AFireworksPawn::TryUpdateLasers()
{
// --- Left Hand ---
// Check if this hand is grabbing anything, if not - continue
if (!IsGrabbingL) {
// --- Left Hand ---
if (TryShowLaserL)
{
FVector StartLocation = LaserL->GetComponentLocation();
@@ -288,17 +287,9 @@ void AFireworksPawn::TryUpdateLasers()
GetWorld()->LineTraceSingleByChannel(CurrentLaserHitL, StartLocation, EndLocation, ECollisionChannel::ECC_Visibility);
LaserL->SetHiddenInGame(false);
LaserL->SetRelativeScale3D(FVector((CurrentLaserHitL.Distance >= 5.0f ? CurrentLaserHitL.Distance : 1000.0f), LaserL->GetRelativeScale3D().Y, LaserL->GetRelativeScale3D().Z));
} // If the laser is visible, and should not - hide it
else if(!LaserL->bHiddenInGame)
{
LaserL->SetHiddenInGame(true);
}
}
}
// --- Right Hand ---
// Check if this hand is grabbing anything, if not - continue
if (!IsGrabbingR) {
if (TryShowLaserR)
{
FVector StartLocation = LaserR->GetComponentLocation();
@@ -306,10 +297,5 @@ void AFireworksPawn::TryUpdateLasers()
GetWorld()->LineTraceSingleByChannel(CurrentLaserHitR, StartLocation, EndLocation, ECollisionChannel::ECC_Visibility);
LaserR->SetHiddenInGame(false);
LaserR->SetRelativeScale3D(FVector((CurrentLaserHitR.Distance >= 5.0f ? CurrentLaserHitR.Distance : 1000.0f), LaserR->GetRelativeScale3D().Y, LaserR->GetRelativeScale3D().Z));
} // If the laser is visible, and should not - hide it
else if (!LaserR->bHiddenInGame)
{
LaserR->SetHiddenInGame(true);
}
}
}
}