void UVehicleWheel::Init( UWheeledVehicleMovementComponent* InVehicleSim, int32 InWheelIndex ) { check(InVehicleSim); check(InVehicleSim->Wheels.IsValidIndex(InWheelIndex)); VehicleSim = InVehicleSim; WheelIndex = InWheelIndex; const int32 WheelShapeIdx = VehicleSim->PVehicle->mWheelsSimData.getWheelShapeMapping( WheelIndex ); check(WheelShapeIdx >= 0); WheelShape = NULL; VehicleSim->PVehicle->getRigidDynamicActor()->getShapes( &WheelShape, 1, WheelShapeIdx ); check(WheelShape); Location = GetPhysicsLocation(); OldLocation = Location; }
void UVehicleWheel::Tick( float DeltaTime ) { OldLocation = Location; Location = GetPhysicsLocation(); Velocity = ( Location - OldLocation ) / DeltaTime; }