Files
gig-line/Game/GigLine/Source/GigLine/GigLineAssetTools.cpp
T
zwitschi 52b1212cf3 qa: make the demo walkable — terrain collision root cause, spawn, scripted QA
The reported fall-through was a misdiagnosis: the player never fell. The
imported Terrain_DEM had only a bounding-box simple collision proxy, so a
downward trace anywhere in the block hit the terrain at Z 819 (the mesh
bbox max) and the street sat under an invisible 8 m lid. Standing on that
box looked plausible, which is why it read as working.

- add UGigLineAssetTools (C++): force CTF_UseComplexAsSimple on a static
  mesh. UE 5.8 dropped bUseComplexAsSimpleCollision and Python cannot set
  the flag; the builder also saves the asset, since the flag lives there
  and a map-only save silently reverts it.
- spawn (-13336, -1150, 600): inside the carved corridor (the cut is a
  10.7 m half-width around the road centreline), lands on the road at 456.
- fix ResetToStart returning to the mid-air PlayerStart captured in
  BeginPlay: StartLocation is now captured on the first grounded frame.
- HighResShot 1280x720 instead of "1280 720", which is a multiplier.
- add -qaselftest: scripted walk/reset/pause on a core ticker plus a
  swept ground transect. Results: walk 746 cm/2 s with Z steady, reset
  0 cm from spawn, pause/unpause 1/0, transect 84 samples 0 holes.
- rebase onto main, keeping the frontage materials and placement fixes.
2026-11-08 11:56:19 +01:00

66 lines
1.4 KiB
C++

#include "GigLineAssetTools.h"
#include "Engine/StaticMesh.h"
#include "PhysicsEngine/BodySetup.h"
#include "StaticMeshResources.h"
void UGigLineAssetTools::SetComplexCollisionAsSimple(UStaticMesh* Mesh, bool bEnable)
{
if (!Mesh)
{
return;
}
UBodySetup* BodySetup = Mesh->GetBodySetup();
if (!BodySetup)
{
return;
}
BodySetup->CollisionTraceFlag = bEnable ? CTF_UseComplexAsSimple : CTF_UseSimpleAndComplex;
BodySetup->InvalidatePhysicsData();
BodySetup->CreatePhysicsMeshes();
Mesh->MarkPackageDirty();
Mesh->PostEditChange();
}
void UGigLineAssetTools::ClearSimpleCollision(UStaticMesh* Mesh)
{
if (!Mesh)
{
return;
}
UBodySetup* BodySetup = Mesh->GetBodySetup();
if (!BodySetup)
{
return;
}
BodySetup->AggGeom.EmptyElements();
BodySetup->InvalidatePhysicsData();
BodySetup->CreatePhysicsMeshes();
Mesh->MarkPackageDirty();
Mesh->PostEditChange();
}
FString UGigLineAssetTools::GetCollisionComplexity(UStaticMesh* Mesh)
{
if (!Mesh)
{
return TEXT("no mesh");
}
const UBodySetup* BodySetup = Mesh->GetBodySetup();
if (!BodySetup)
{
return TEXT("no body setup");
}
const int32 Flag = static_cast<int32>(BodySetup->CollisionTraceFlag.GetValue());
if (Flag == CTF_UseComplexAsSimple) { return TEXT("UseComplexAsSimple"); }
if (Flag == CTF_UseSimpleAsComplex) { return TEXT("UseSimpleAsComplex"); }
if (Flag == CTF_UseSimpleAndComplex) { return TEXT("UseSimpleAndComplex"); }
return TEXT("ProjectDefault");
}