Download

Add Bone Rotation in C++

Hey guys, I’m looking for help solving an issue I’ve run in to with Rotators.

I’m able to rotate the bones, but the FRotator locks at 90 degrees.

Any way around this?


void AAircraftPawn::AnimateProps(float DeltaTime)
{
    FRotator CurrentRotation = PoseMesh->GetBoneRotationByName(FName("Prop_left"), EBoneSpaces::ComponentSpace);

    FRotator PropRotation = CurrentRotation;
    PropRotation.Pitch -= PropSpeed * DeltaTime;

    PoseMesh->SetBoneRotationByName(FName("Prop_left"), PropRotation, EBoneSpaces::ComponentSpace);
    PoseMesh->SetBoneRotationByName(FName("Prop_right"), PropRotation, EBoneSpaces::ComponentSpace);

    //GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Yellow, PropRotation.ToString());
}