test(vehicle): wheels are created with the physics state, and still come out zero
Two measurement errors found and corrected before drawing any conclusion:
- the vehicle pawn had been dropped from the map by an earlier cleanup; it is staged again
- wheels are created in CreateVehicle(), i.e. when the physics state is built, so counting
them in BeginPlay always read zero regardless
Measured once physics exists, the count is still **0**, and the bone theory is dead: the
skeleton has Wheel_FL/FR/RL/RR at indices 2-5 and every setup resolves to its bone.
CreateWheels() runs only inside CreateVehicle() when PVehicleOutput is valid, so a zero count
means the physics state never produced a vehicle - the problem is upstream of the wheel config,
in the physics asset or the way the skeletal mesh binds it, not in the wheel setups.
Also logged at the settle check: the pawn's own downward trace reports ground at Z 152 while
the visible car's panels stand on a road of 366, so the pawn and the visible car may not be in
the same place at all - worth checking before anything else.
This commit is contained in:
1 parent
1da209a902
commit
58095b6a33
22 files changed
+56
-22
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -233,8 +233,25 @@ void AGigLineVehicle::BeginPlay()
|
||||
BodyComp->bHiddenInGame ? 1 : 0,
|
||||
*BodyComp->Bounds.BoxExtent.ToString());
|
||||
}
|
||||
// Name the bones and check each setup against them: Chaos silently creates no wheel
|
||||
// when a setup's bone is not on the mesh, which is how four setups produced zero
|
||||
// wheels without a warning.
|
||||
if (USkeletalMeshComponent* Body = GetMesh())
|
||||
{
|
||||
TArray<FName> Bones;
|
||||
Body->GetBoneNames(Bones);
|
||||
UE_LOG(LogTemp, Warning, TEXT("GigLine vehicle: %d bones, e.g. %s"),
|
||||
Bones.Num(),
|
||||
Bones.Num() > 0 ? *Bones[FMath::Min(1, Bones.Num() - 1)].ToString() : TEXT("none"));
|
||||
for (const FChaosWheelSetup& Setup : Movement->WheelSetups)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("GigLine vehicle: setup bone '%s' index %d"),
|
||||
*Setup.BoneName.ToString(), Body->GetBoneIndex(Setup.BoneName));
|
||||
}
|
||||
}
|
||||
UE_LOG(LogTemp, Warning,
|
||||
TEXT("GigLine vehicle: %d wheel objects after register, torque %.0f"),
|
||||
TEXT("GigLine vehicle: %d wheel objects at BeginPlay (wheels are created later, "
|
||||
"with the physics state), torque %.0f"),
|
||||
Movement->Wheels.Num(), Movement->EngineSetup.MaxTorque);
|
||||
}
|
||||
UE_LOG(LogTemp, Warning, TEXT("GigLine vehicle: spawned at (%.0f, %.0f, %.0f), %d wheel setups"),
|
||||
@@ -285,6 +302,13 @@ void AGigLineVehicle::Tick(float DeltaSeconds)
|
||||
if (!bSettleReported && SettleElapsed > 3.0f)
|
||||
{
|
||||
bSettleReported = true;
|
||||
if (const UChaosWheeledVehicleMovementComponent* Wheeled =
|
||||
Cast<UChaosWheeledVehicleMovementComponent>(GetVehicleMovementComponent()))
|
||||
{
|
||||
UE_LOG(LogTemp, Warning,
|
||||
TEXT("GigLine vehicle: %d wheel objects once physics exists"),
|
||||
Wheeled->Wheels.Num());
|
||||
}
|
||||
if (UWorld* World = GetWorld())
|
||||
{
|
||||
FHitResult Hit;
|
||||
|
||||
@@ -700,6 +700,16 @@ def build():
|
||||
vehicle_origin = unreal.Vector(-12950.0, -900.0, 367.0)
|
||||
vehicle_rotation = unreal.Rotator(pitch=0.0, yaw=0.0, roll=0.0)
|
||||
|
||||
# The physics pawn: Chaos needs it even while the visible car is a set of plain
|
||||
# panels, because that is the component that owns the wheels and the movement.
|
||||
vehicle_class = unreal.load_class(None, "/Script/GigLine.GigLineVehicle")
|
||||
if vehicle_class:
|
||||
pawn = spawn(vehicle_class, vehicle_origin, "Demo_Vehicle_Sedan")
|
||||
log(f"staged: Demo_Vehicle_Sedan ({'ok' if pawn else 'FAILED'})")
|
||||
else:
|
||||
log("staged: Demo_Vehicle_Sedan skipped - class not found")
|
||||
|
||||
|
||||
panel_systems = (
|
||||
"SM_Vehicle_Body",
|
||||
"SM_Vehicle_Trim",
|
||||
|
||||
Reference in new issue
Block a user