fix(vehicle): set PhysicsType=Simulated so the chassis body simulates
The physics asset body was missing PhysicsType. BuildPhysicsAsset created the
USkeletalBodySetup with a box but never set Body->PhysicsType, leaving it
PhysType_Default ('follow owner'). The base AWheeledVehiclePawn sets
Mesh->BodyInstance.bSimulatePhysics=false (the Chaos async solver drives it), so
'follow owner' meant the chassis never simulated - the vehicle sat frozen at
spawn (simulating=0) and -drivetest reported speed=0 travelled=0.
Set Body->PhysicsType = EPhysicsType::PhysType_Simulated. Result: simulating=1,
settled at Z 77 cm, and the drive test moves the car (36.3 m). It drives backwards
(-96.5 km/h) - the next bug is the reverse direction, not the physics setup.
This commit is contained in:
1 parent
5bb7843b94
commit
927e9376a8
4 files changed
+316
-57
No files matched your search
@@ -45,6 +45,11 @@ UPhysicsAsset* UGigLineVehicleBuilder::BuildPhysicsAsset(USkeletalMesh* Mesh,
|
||||
USkeletalBodySetup* Body = NewObject<USkeletalBodySetup>(PhysicsAsset, ChassisBone,
|
||||
RF_Public | RF_Transactional);
|
||||
Body->BoneName = ChassisBone;
|
||||
// The body must simulate, not follow the mesh component's bSimulatePhysics. The
|
||||
// base AWheeledVehiclePawn sets that to false, so PhysType_Default leaves the chassis
|
||||
// unsimulated and the vehicle sits frozen at spawn; PhysType_Simulated makes the Chaos
|
||||
// async solver drive it.
|
||||
Body->PhysicsType = EPhysicsType::PhysType_Simulated;
|
||||
// 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;
|
||||
|
||||
Reference in new issue
Block a user