Hello,
I’m currently trying to make an arcady flight-sim type game/experiment. I’ve got lift, thrust, drag and weight, but I’m doing this in the following manner:
void APlayerPlane::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
PlaneMesh->SetPhysicsLinearVelocity(CalculateVelocityVector());
}
and the CalculateVelocityVector() function later on in the file:
FVector APlayerPlane::CalculateVelocityVector()
{
FVector VelocityVector = FVector::ZeroVector;
VelocityVector += GetGravityDirection() * GetWorld()->GetGravityZ();
VelocityVector += GetActorUpVector() * lift;
VelocityVector += GetActorForwardVector() * thrust;
return VelocityVector;
}
Now, I realize I’m only using the SetPhysicsLinearVelocity(), but I can’t for the life of me figure out how to do turning while banking. SetPhysicsAngularVelocity() seems like the way to go, but I can’t seem to find the correct way to use it. I think I need to find the sideways component of the lift vector and then use that, but not sure how to go about it.
I’ve also thought about using AddForce, not sure if that’s a better way to do things.
If anyone has any insight or an article I can read that’d be great.
Thanks!