diff --git a/Game/GigLine/Content/Hollywood/Vehicle/PA_Vehicle_Sedan.uasset b/Game/GigLine/Content/Hollywood/Vehicle/PA_Vehicle_Sedan.uasset index 3187b08..6ac4b68 100644 --- a/Game/GigLine/Content/Hollywood/Vehicle/PA_Vehicle_Sedan.uasset +++ b/Game/GigLine/Content/Hollywood/Vehicle/PA_Vehicle_Sedan.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9369e54b7a0ec32d61be8fd4d27899f8a5ec85b895c120c094205fd00a568325 +oid sha256:6a59a116e5bbec41a67f643d785f0377a48c2aa1f4e8d0a3e2c55a4bf6515728 size 2774 diff --git a/Game/GigLine/Content/Hollywood/Vehicle/SK_Vehicle_Sedan.uasset b/Game/GigLine/Content/Hollywood/Vehicle/SK_Vehicle_Sedan.uasset index 30dc0b8..792d745 100644 --- a/Game/GigLine/Content/Hollywood/Vehicle/SK_Vehicle_Sedan.uasset +++ b/Game/GigLine/Content/Hollywood/Vehicle/SK_Vehicle_Sedan.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:54bf640496c38ba9a740c8984e0b00fe602ef4987dd64b492177aaefec8db785 -size 254636 +oid sha256:bab3382656738c0ef807eef9d053340f71823cced744101987b07619816f0647 +size 32706361 diff --git a/Game/GigLine/Content/Hollywood/Vehicle/SK_Vehicle_Sedan_Skeleton.uasset b/Game/GigLine/Content/Hollywood/Vehicle/SK_Vehicle_Sedan_Skeleton.uasset index 084a19c..8c9afe4 100644 --- a/Game/GigLine/Content/Hollywood/Vehicle/SK_Vehicle_Sedan_Skeleton.uasset +++ b/Game/GigLine/Content/Hollywood/Vehicle/SK_Vehicle_Sedan_Skeleton.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3fdd844087fdb0552ed99de2ab617a4b670cda0ba77d5bcea25413bc23312f0c +oid sha256:7bde67380b5e495dbf7ceffd1408078fa5d7a75942d901bc94b39409b1ae67c6 size 3064 diff --git a/Game/GigLine/Source/GigLine/GigLineVehicle.cpp b/Game/GigLine/Source/GigLine/GigLineVehicle.cpp index 901dd64..4a85206 100644 --- a/Game/GigLine/Source/GigLine/GigLineVehicle.cpp +++ b/Game/GigLine/Source/GigLine/GigLineVehicle.cpp @@ -445,19 +445,22 @@ void AGigLineVehicle::Tick(float DeltaSeconds) // If the Chaos vehicle never came into existence (no wheels), its movement component has no // valid state to drive, and continuing to tick it writes whatever is in that empty state back // onto the actor - which is the only explanation that fits a still body and a moving actor. + // Only stop in that case: with real wheels the mover must keep ticking to drive, and stopping + // it at 2.5 s was what killed the drive test (throttle runs 1-4 s). if (!bMoverStopped && SettleElapsed > 2.5f) { - bMoverStopped = true; - if (const UChaosWheeledVehicleMovementComponent* WheelComp = - Cast(GetVehicleMovementComponent())) + const UChaosWheeledVehicleMovementComponent* WheelComp = + Cast(GetVehicleMovementComponent()); + if (!WheelComp || WheelComp->Wheels.Num() == 0) { + bMoverStopped = true; UE_LOG(LogTemp, Warning, TEXT("GigLine vehicle: stopping the mover - wheels=%d at Z %.0f"), - WheelComp->Wheels.Num(), GetActorLocation().Z); - } - if (UMovementComponent* Mover = GetVehicleMovementComponent()) - { - Mover->SetComponentTickEnabled(false); + WheelComp ? WheelComp->Wheels.Num() : -1, GetActorLocation().Z); + if (UMovementComponent* Mover = GetVehicleMovementComponent()) + { + Mover->SetComponentTickEnabled(false); + } } } diff --git a/Game/GigLine/Source/GigLine/GigLineVehicleBuilder.cpp b/Game/GigLine/Source/GigLine/GigLineVehicleBuilder.cpp index 74a7c59..0d839a6 100644 --- a/Game/GigLine/Source/GigLine/GigLineVehicleBuilder.cpp +++ b/Game/GigLine/Source/GigLine/GigLineVehicleBuilder.cpp @@ -53,14 +53,17 @@ UPhysicsAsset* UGigLineVehicleBuilder::BuildPhysicsAsset(USkeletalMesh* Mesh, // A box slightly under the mesh bounds: a body that is exactly the bounds sits on the // ground plane and reads as floating because the mesh has wheels below the sills. FKBoxElem Box; + // The skeletal mesh imports ROLLED (height along Y, width along Z) while the armature is + // unrolled (height Z, width Y). The box is a body on the root bone, so it must be built in + // the UNROLLED frame: length from mesh X, width from mesh Z, height from mesh Y. Box.X = Extent.X * 1.9f; - Box.Y = Extent.Y * 1.8f; - Box.Z = Extent.Z * 0.55f; - // The chassis body must sit ABOVE the ground (the car body is at Z 0..height), not below - // the root bone. The old -Extent.Z*0.25 put the box below the ground and the suspension - // (measured against the root bone) then pushed the chassis upward. Place it at the car's - // mid-height instead. - Box.Center = FVector(0.f, 0.f, Extent.Z * 0.35f); + Box.Y = Extent.Z * 1.8f; + Box.Z = Extent.Y * 0.55f; + // The chassis sits at the car's centre of mass, which is the rolled mesh's mid-height + // (Bounds.Origin.Y) mapped onto the unrolled height axis (Z). The suspension rest position is + // measured against the root bone (the grounded origin), so the box must sit at the centre of + // mass rather than the root bone - this is what settled the vehicle on the road. + Box.Center = FVector(0.f, 0.f, Bounds.Origin.Y); Body->AggGeom.BoxElems.Add(Box); PhysicsAsset->SkeletalBodySetups.Add(Body);