Compare commits
2
Commits
98eae6f3e9
...
f4c1fed99b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4c1fed99b | ||
|
|
cc57ad6c02 |
No files matched your search
@@ -340,20 +340,10 @@ 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);
|
||||
}
|
||||
// Foot-contact diagnostic, one line per channel: the player stands at 561 while the
|
||||
// Visibility trace reports ground at 366, so at least one channel is seeing a different
|
||||
// surface than the one under foot. This names the actor and the Z for each channel.
|
||||
// Foot-contact probe runs from Tick three seconds after spawn — see LogFootProbes().
|
||||
|
||||
bWalkForever = FParse::Param(FCommandLine::Get(), TEXT("walk"));
|
||||
bCameraTest = FParse::Param(FCommandLine::Get(), TEXT("cameratest"));
|
||||
@@ -380,6 +370,32 @@ FVector AGigLineCharacter::GetThirdPersonCameraLocation() const
|
||||
return ThirdPersonCamera ? ThirdPersonCamera->GetComponentLocation() : GetActorLocation();
|
||||
}
|
||||
|
||||
void AGigLineCharacter::LogFootProbes()
|
||||
{
|
||||
UWorld* World = GetWorld();
|
||||
if (!World)
|
||||
{
|
||||
return;
|
||||
}
|
||||
static const TCHAR* Names[] = {TEXT("Visibility"), TEXT("WorldStatic"), TEXT("Pawn")};
|
||||
static const ECollisionChannel Channels[] = {ECC_Visibility, ECC_WorldStatic, ECC_Pawn};
|
||||
const float CapsuleHalf = GetCapsuleComponent()
|
||||
? GetCapsuleComponent()->GetScaledCapsuleHalfHeight() : 0.f;
|
||||
const FVector Feet = GetActorLocation() - FVector(0.f, 0.f, CapsuleHalf);
|
||||
for (int32 Index = 0; Index < 3; ++Index)
|
||||
{
|
||||
FHitResult Hit;
|
||||
FCollisionQueryParams Q(TEXT("GigLineFoot"), false, this);
|
||||
const bool bHit = World->LineTraceSingleByChannel(Hit, Feet + FVector(0.f, 0.f, 5.f),
|
||||
Feet - FVector(0.f, 0.f, 1500.f), Channels[Index], Q);
|
||||
UE_LOG(LogTemp, Warning,
|
||||
TEXT("GigLine foot %s after settling: actor Z %.0f, feet %.0f, hit=%d Z=%.0f actor=%s"),
|
||||
Names[Index], GetActorLocation().Z, Feet.Z, bHit ? 1 : 0,
|
||||
bHit ? Hit.ImpactPoint.Z : -9999.f,
|
||||
bHit && Hit.GetActor() ? *Hit.GetActor()->GetName() : TEXT("none"));
|
||||
}
|
||||
}
|
||||
|
||||
void AGigLineCharacter::UpdateCameraCollisionTest(float DeltaSeconds)
|
||||
{
|
||||
// Deterministic on purpose. Finding a wall in the street wasted four runs: the
|
||||
@@ -977,6 +993,15 @@ void AGigLineCharacter::Tick(float DeltaSeconds)
|
||||
UpdateCameraCollisionTest(GetWorld() ? GetWorld()->GetDeltaSeconds() : 0.f);
|
||||
}
|
||||
|
||||
if (FootProbeDelay > 0.f)
|
||||
{
|
||||
FootProbeDelay -= GetWorld() ? GetWorld()->GetDeltaSeconds() : 0.f;
|
||||
if (FootProbeDelay <= 0.f)
|
||||
{
|
||||
LogFootProbes();
|
||||
}
|
||||
}
|
||||
|
||||
WalkForever();
|
||||
UpdateBodyAnimation();
|
||||
|
||||
|
||||
@@ -210,6 +210,10 @@ protected:
|
||||
UPROPERTY()
|
||||
TObjectPtr<class AStaticMeshActor> CameraTestWall;
|
||||
|
||||
/** Seconds until the foot-contact probe runs; 0 disables it. */
|
||||
float FootProbeDelay = 0.f;
|
||||
void LogFootProbes();
|
||||
|
||||
FVector LastWallNormal = FVector::ZeroVector;
|
||||
bool bCameraTest = false;
|
||||
bool CameraTestPlaced = false;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "GigLineVehicle.h"
|
||||
|
||||
#include "ChaosVehicleWheel.h"
|
||||
#include "ChaosWheeledVehicleMovementComponent.h"
|
||||
#include "Components/SkeletalMeshComponent.h"
|
||||
|
||||
@@ -12,6 +13,28 @@ namespace GigLineVehicleDims
|
||||
constexpr float TrackCm = 156.0f;
|
||||
}
|
||||
|
||||
UGigLineFrontWheel::UGigLineFrontWheel()
|
||||
{
|
||||
// Dimensions from the model's report: radius 33 cm, width 22 cm. Steering yes, drive no.
|
||||
WheelRadius = 33.0f;
|
||||
WheelWidth = 22.0f;
|
||||
bAffectedBySteering = true;
|
||||
bAffectedByEngine = false;
|
||||
MaxSteerAngle = 35.0f;
|
||||
SuspensionMaxRaise = 8.0f;
|
||||
SuspensionMaxDrop = 8.0f;
|
||||
}
|
||||
|
||||
UGigLineRearWheel::UGigLineRearWheel()
|
||||
{
|
||||
WheelRadius = 33.0f;
|
||||
WheelWidth = 22.0f;
|
||||
bAffectedBySteering = false;
|
||||
bAffectedByEngine = true;
|
||||
SuspensionMaxRaise = 8.0f;
|
||||
SuspensionMaxDrop = 8.0f;
|
||||
}
|
||||
|
||||
AGigLineVehicle::AGigLineVehicle()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
@@ -131,9 +154,10 @@ void AGigLineVehicle::ConfigureWheels()
|
||||
for (const FWheelSpec& Spec : Specs)
|
||||
{
|
||||
FChaosWheelSetup Setup;
|
||||
// FChaosWheelSetup has only the class, the bone and an offset in 5.8 - there is
|
||||
// no per-setup disable flag, and steering/drive flags live on the wheel object.
|
||||
Setup.WheelClass = UChaosVehicleWheel::StaticClass();
|
||||
// FChaosWheelSetup has only the class, the bone and an offset in 5.8 - there is no
|
||||
// per-setup disable flag, and steering/drive flags live on the wheel class.
|
||||
Setup.WheelClass = Spec.bSteer ? UGigLineFrontWheel::StaticClass()
|
||||
: UGigLineRearWheel::StaticClass();
|
||||
Setup.BoneName = FName(Spec.Bone);
|
||||
Movement->WheelSetups.Add(Setup);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ChaosVehicleWheel.h"
|
||||
#include "WheeledVehiclePawn.h"
|
||||
#include "GigLineVehicle.generated.h"
|
||||
|
||||
class UChaosWheeledVehicleMovementComponent;
|
||||
|
||||
/**
|
||||
* Front and rear wheel classes.
|
||||
*
|
||||
* Chaos reads steering and drive flags from the wheel *object* the setup points at, and the
|
||||
* base `UChaosVehicleWheel` is what the first attempt used - which produced zero wheels
|
||||
* after registration. Giving each axle its own class is also what Unreal's own vehicle
|
||||
* template does, for the same reason: the parameters belong to the class, not to the
|
||||
* instance that arrives later.
|
||||
*/
|
||||
UCLASS()
|
||||
class GIGLINE_API UGigLineFrontWheel : public UChaosVehicleWheel
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UGigLineFrontWheel();
|
||||
};
|
||||
|
||||
UCLASS()
|
||||
class GIGLINE_API UGigLineRearWheel : public UChaosVehicleWheel
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UGigLineRearWheel();
|
||||
};
|
||||
|
||||
/**
|
||||
* The one drivable vehicle in the demo.
|
||||
*
|
||||
|
||||
@@ -23,7 +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.
|
||||
- [~] Fix the character and car floating. **The measurement was taken at the wrong moment.** The foot probe ran in `BeginPlay`, while the pawn is still at its spawn height and falling, so every trace reported a surface far below it (`ground 366` against an actor at 561) and read as a float that was not there. The probe now runs **three seconds after spawn**, from the capsule's feet, on three channels, and names the actor it hits. 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.
|
||||
- [x] Fix the vehicle's material colour. The template's `car paint` is a legacy mix-shader graph that the FBX exporter cannot map, so `SM_Vehicle_Body` imported holding `WorldGridMaterial` and rendered black while Blender showed red. Legacy graphs are now converted to Principled before export (saturated colour wins over the grey diffuse next to it), and the staged body panel is assigned `M_Vehicle_HatchPaint`. Judge: `verdict=yes confidence=0.9`.
|
||||
- [x] Fix the missing vehicle glazing. The `windows` material was metallic 1.0 with roughness 0.0 - a black void that read as an empty cabin. Now tinted translucent (opacity 0.85, roughness 0.08); opacity 0.45 was tried first and made the glass invisible. The vision judge still returns `verdict=no` for the frame, disagreeing with what is visibly tinted glass; it is advisory, and the human verdict decides.
|
||||
- [ ] Implement enter/exit interaction.
|
||||
|
||||
Reference in new issue
Block a user