Working on look-at Widgets, not done yet.

This commit is contained in:
2025-03-17 15:35:51 -04:00
parent c9fd224a38
commit 6b8c86a03c
7 changed files with 107 additions and 60 deletions

View File

@@ -182,7 +182,12 @@ void AIntegrationGameModeBase::LuaCallEnd(InvocationKind kind, AActor *place) {
if (place == nullptr) {
LuaCallEnd(kind, int64(0));
} else {
LuaCallEnd(kind, UlxTangible::GetActorTangible(place)->TangibleId);
UlxTangible *tan = UlxTangible::GetActorTangibleOrLog(place);
if (tan == nullptr) {
LuaCallResult.clear();
} else {
LuaCallEnd(kind, tan->TangibleId);
}
}
}
@@ -334,16 +339,17 @@ int64 AIntegrationGameModeBase::GetPlayerId() {
return PlayerId;
}
AIntegrationGameModeBase *AIntegrationGameModeBase::GetFromWorld(UWorld *world) {
AIntegrationGameModeBase *result = world->GetAuthGameMode<AIntegrationGameModeBase>();
AIntegrationGameModeBase *AIntegrationGameModeBase::GetLuprexGameMode(UObject *context) {
AIntegrationGameModeBase *result = context->GetWorld()->GetAuthGameMode<AIntegrationGameModeBase>();
if (result == nullptr) {
UE_LOG(LogBlueprint, Fatal, TEXT("No IntegrationGameModeBase in this context"));
UE_LOG(LogBlueprint, Fatal, TEXT("Not currently using a Luprex Game Mode."));
}
return result;
}
AIntegrationGameModeBase *AIntegrationGameModeBase::GetFromContext(UObject *context) {
return GetFromWorld(context->GetWorld());
bool AIntegrationGameModeBase::IsLookAtChanged(UObject *context) {
AIntegrationGameModeBase *mode = GetLuprexGameMode(context);
return mode->CurrentLookAt.HitObjectHandle != mode->PreviousLookAt.HitObjectHandle;
}
void AIntegrationGameModeBase::UpdateLookAt() {
@@ -362,6 +368,10 @@ void AIntegrationGameModeBase::UpdateLookAt() {
APlayerCameraManager *cam = pc->PlayerCameraManager;
if (cam == nullptr) return;
CalculateLookAt(pawn, pc, cam);
CalculateLookAt(pc);
if (IsLookAtChanged(this)) {
LookAtChanged();
}
}