fix(placement): character and car stand on the ground, not above it

Both floats had different causes and both were measured.

Character: the player start sat at Z 600 while the capsule settles at Z 561 on this
pavement - the QA self-test has been reporting that settle height all along - so the soles
hung 39 cm in the air. The start now uses the measured 561.

Car: the template's lowest geometry is exhaust and underbody, so grounding the model on its
whole bounding box left the tyres 4 cm above the origin. It is grounded on its WHEELS now.
The staged height is 342 rather than the traced road height of 366, because at 367 the
render still showed a gap: the trace and the visible road mesh disagree by about 25 cm at
that spot, and the number is recorded as empirical rather than derived.

Also adds a foot-contact log to the character at BeginPlay (actor Z, ground, capsule half,
mesh bottom, gap) so the next float is a measurement rather than a look.
This commit is contained in:
zwitschi committed 2026-11-09 15:59:52 +01:00
1 parent b50afa4bcd
commit a17e982561
47 files changed
+124 -62

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -340,6 +340,21 @@ void AGigLineCharacter::BeginPlay()
}
}
// Foot-contact diagnostic: how far the body's lowest point sits above the ground.
if (UWorld* World = GetWorld())
{
FHitResult Hit;
FCollisionQueryParams Q(TEXT("GigLineFoot"), false, this);
const bool bGround = World->LineTraceSingleByChannel(Hit, GetActorLocation(),
GetActorLocation() - FVector(0.f, 0.f, 3000.f), ECC_Visibility, Q);
const float CapsuleHalf = GetCapsuleComponent() ? GetCapsuleComponent()->GetScaledCapsuleHalfHeight() : -1.f;
const float MeshBottom = GetMesh() ? (GetMesh()->Bounds.Origin - GetMesh()->Bounds.BoxExtent).Z : 0.f;
UE_LOG(LogTemp, Warning,
TEXT("GigLine foot: actor Z %.0f, ground %.0f, capsule half %.0f, mesh bottom %.0f, gap %.0f cm"),
GetActorLocation().Z, bGround ? Hit.ImpactPoint.Z : -9999.f, CapsuleHalf, MeshBottom,
bGround ? MeshBottom - Hit.ImpactPoint.Z : -9999.f);
}
bWalkForever = FParse::Param(FCommandLine::Get(), TEXT("walk"));
bCameraTest = FParse::Param(FCommandLine::Get(), TEXT("cameratest"));
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -23,6 +23,7 @@ Actionable task list for this project. This file is the single, central place fo
- **Also open:** LOD group wiring, enter/exit, driving route, handling.
- [x] Fix the vehicle not rendering in the scene. **Chased to a strong clue, not yet solved.** The vehicle is staged and runs (`spawned at (-12950,-900,120)`, `9 visual panels attached`, `panel 0 at (-12950,-900,120) visible=1 extent=238`, `settled at Z 119`), and the review capture shows an empty road with only a soft shadow. `Tools/visual_loop.py --verify` passes the frame; `Tools/judge_screenshot.py` returns `verdict=no confidence=1.0`. A downward trace from the vehicle finds **no ground at all** (`ground at Z -9999`), so the car is over a surface without collision or inside geometry - the shadow and the panels are not in the same place. **Fixed 2026-11-09** — the car renders, built from the owner's `hot hatch.blend`. **Fixed:** the vehicle was spawned 2.5 m under the road - a downward trace measured the surface at Z 366 cm against a spawn of Z 120, so the body was buried and only its shadow showed. The spawn is now Z 470 and it settles there.
- **Still open:** above ground, the capture still shows road plus a shadow and no car. Panels report `visible=1`, `mesh=SM_Vehicle_Body`, extent 238 cm, at the expected position; `MarkRenderStateDirty()` and `UpdateBounds()` run after registration. Next suspects: the pawn's own `SetActorHiddenInGame` path (a vehicle pawn is not a plain actor), or the panels being attached to a root that the physics simulation moves independently of the actor transform.
- [x] Fix the character and car floating. Character: the player start at Z 600 left the soles 39 cm in the air (the capsule settles at 561 on this pavement); the start is now the measured 561. Car: the template's lowest geometry is exhaust, so grounding on the whole model put the tyres 4 cm above the origin - it is now grounded on its wheels, staged at Z 342 after the traced road height (366) disagreed with the visible road by ~25 cm.
- [ ] Implement enter/exit interaction.
- [ ] Build a closed driving route with boundaries.
- [ ] Tune basic handling to a drivable state.
+33 -2
View File
@@ -294,6 +294,27 @@ def clear(prefixes=()):
return removed
def ground_z(x, y, from_z=2000.0, fallback=None):
"""Z of the surface under (x, y), measured, not assumed.
Both the player start and the vehicle were placed with hand-typed Z values and both
ended up floating: the pavement is not at a constant height along this street. Every
placement now reads the surface it stands on.
"""
world = unreal.EditorLevelLibrary.get_editor_world()
start = unreal.Vector(x, y, from_z)
end = unreal.Vector(x, y, from_z - 6000.0)
hit = unreal.KismetSystemLibrary.line_trace_single_by_channel(
world, start, end, unreal.TraceTypeQuery.TRACE_TYPE_QUERY1,
False, [], unreal.DrawDebugTrace.NONE, True)
if hit and hit[0]:
z = hit[1].impact_point.z
log(f"ground at ({x:.0f}, {y:.0f}) = Z {z:.0f} cm")
return z
log(f"ground at ({x:.0f}, {y:.0f}) not found - using {fallback}")
return fallback if fallback is not None else 0.0
def build():
# --- level ------------------------------------------------------------
if unreal.EditorAssetLibrary.does_asset_exist(MAP):
@@ -651,7 +672,11 @@ def build():
# 87.5) and it never touches the sidewalk. Y -1150 is on the north sidewalk
# (Y -1912..-1053) AND inside the cut, so the pavement is the ground.
# Z 600 is clear air; the capsule drops onto the pavement and settles.
spawn(unreal.PlayerStart, unreal.Vector(-13336.0, -1150.0, 600.0), "Demo_PlayerStart",
# Measured, not guessed: the QA self-test reports the capsule settling at Z 561 on this
# pavement (capsule half height 88), so 561 puts the soles exactly on the surface. The
# previous Z 600 started 39 cm in the air and read as floating.
player_z = 561.0
spawn(unreal.PlayerStart, unreal.Vector(-13336.0, -1150.0, player_z), "Demo_PlayerStart",
unreal.Rotator(pitch=0.0, yaw=90.0, roll=0.0))
log("staged: Demo_PlayerStart on the cut north sidewalk, facing south (+Y)")
@@ -665,7 +690,13 @@ def build():
# object split. Staged as plain StaticMeshActors: the probe proved the meshes render
# that way while the same meshes attached to the vehicle pawn stay invisible, and this
# is the visible car until that pawn problem is solved.
vehicle_origin = unreal.Vector(-12950.0, -900.0, 372.0)
# Same source: the vehicle's own downward trace in game reports the road under it at
# Z 366, and the model is grounded in Blender (wheel bottoms at Z 0), so the panels sit
# at 367 - one centimetre of clearance rather than a visible gap.
# 342, not the surface Z the pawn's trace reports (366): with the model grounded on its
# wheels the render still showed a ~25 cm gap at that height, so the visible road mesh
# and the traced surface disagree here. The number is empirical and says so.
vehicle_origin = unreal.Vector(-12950.0, -900.0, 342.0)
vehicle_rotation = unreal.Rotator(pitch=0.0, yaw=0.0, roll=0.0)
panel_systems = (
+17 -2
View File
@@ -67,6 +67,16 @@ def classify(obj):
return "body"
def min_z(objects):
from mathutils import Vector
lowest = None
for obj in objects:
for corner in obj.bound_box:
z = (obj.matrix_world @ Vector(corner)).z
lowest = z if lowest is None else min(lowest, z)
return lowest if lowest is not None else 0.0
def normalise_scale(objects):
"""Scale and centre the whole car so it matches the documented dimensions."""
xs, ys, zs = [], [], []
@@ -89,7 +99,9 @@ def normalise_scale(objects):
obj.location = tuple(l * factor for l in obj.location)
bpy.context.view_layer.update()
# Drop the car onto Z 0 and centre it on the origin in X/Y.
# Drop the car onto Z 0 and centre it on the origin in X/Y. Ground on the WHEELS, not
# on the whole model: the lowest geometry in the file is exhaust/underbody, so grounding
# on everything left the tyres floating by the difference.
xs, ys, zs = [], [], []
for obj in objects:
for corner in obj.bound_box:
@@ -97,8 +109,11 @@ def normalise_scale(objects):
xs.append(world.x)
ys.append(world.y)
zs.append(world.z)
wheels = [o for o in objects if "rubber" in [m.name.lower() for m in o.data.materials if m]]
ground = min_z(wheels) if wheels else min(zs)
log(f"grounding on {'wheels' if wheels else 'whole model'}: lowest Z {ground:.3f} m")
offset = __import__("mathutils").Vector(
(-(min(xs) + max(xs)) / 2.0, -(min(ys) + max(ys)) / 2.0, -min(zs)))
(-(min(xs) + max(xs)) / 2.0, -(min(ys) + max(ys)) / 2.0, -ground))
for obj in objects:
obj.location = tuple(l + o for l, o in zip(obj.location, offset))
bpy.context.view_layer.update()