МЛ
Size: a a a
МЛ
МЛ
МЛ
//Ship Rotation
//Yaw
DeltaInertia = CalculateInertia(RotationInertia.Z, TargetRotationInputVector.Z * 3.6f, ShipMainAcceleration, DeltaTime);
RotationInertia += FVector::UpVector * DeltaInertia;
//Pitch
DeltaInertia = CalculateInertia(RotationInertia.Y, TargetRotationInputVector.Y * 3.6f, ShipMainAcceleration, DeltaTime);
RotationInertia += FVector::RightVector * DeltaInertia;
//Roll
DeltaInertia = CalculateInertia(RotationInertia.X, TargetRotationInputVector.X * 3.6f * SpeedLimit, ShipMainAcceleration, DeltaTime);
RotationInertia += FVector::ForwardVector * DeltaInertia;
AN

МЛ
МЛ
CalculateInertia(float LocalSpaceInertiaElement, float TargetSpeedElement, float AccelerationElement, float DeltaTime, bool ReverseHalf)
{
float TargetSpeedThisFrame = TargetSpeedElement * DeltaTime;
float AccelerationThisFrame = AccelerationElement * DeltaTime;
float DeltaAccel = FMath::Abs(TargetSpeedThisFrame - LocalSpaceInertiaElement);
float Accel = DeltaAccel < AccelerationThisFrame ? DeltaAccel : AccelerationThisFrame;
if (LocalSpaceInertiaElement > TargetSpeedThisFrame)
{
Accel *= ReverseHalf ? -0.5f : -1;
}
return Accel; // from GE to SW
}
МЛ
AN
SM
DS
VV
DS
VV
VV
МЛ
МЛ
FRotator DeltaRotation;
DeltaRotation.Yaw = RotationInertia.Z;
DeltaRotation.Pitch = RotationInertia.Y;
DeltaRotation.Roll = RotationInertia.X;
FQuat NewRotation = UpdatedComponent->GetComponentQuat() * DeltaRotation.Quaternion();
МЛ
МЛ
МЛ