My case: I want to rotate camera / pan after player holds one of mouse buttons.
-
I got 2 functions that rotate / pan camera. I bound them to Mouse clicks (middle and right)
-
I did variable pointer to read Axis Values.
-
But I don’t know how to consume action value or do it otherway.
MouseXYBindingValue = &( EnhancedInputComponent->BindActionValue(MouseXYAction) );
// Pawn Header
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
TObjectPtr<class UEnhancedInputComponent> EnhancedInputComponent;
UPROPERTY(EditAnywhere, BlueprintReadOnly)
TObjectPtr<class UInputMappingContext> BuilderInputMappingContext;
UPROPERTY(EditAnywhere, BlueprintReadOnly)
TObjectPtr<class UInputAction> MouseXYAction;
TObjectPtr<struct FEnhancedInputActionValueBinding> MouseXYBindingValue;
/// .cpp
/// Functions that rotate / pan camera
void ABuilderPawn::HandleRotationUnBound(const FInputActionValue& value)
{
FVector2D rotat = MouseXYBindingValue->GetValue().Get<FVector2D>();
UE_LOGFMT(YasiuPlayerLog, VeryVerbose, "Camera rotation: {0}", rotat.ToString());
FRotator curRot = SpringArm->GetRelativeRotation();
RotateVectorKeepRoll(curRot, rotat.Y * camYawSensitivity, rotat.X * camPitchSensitivity);
SpringArm->SetRelativeRotation(curRot);
//UE_LOGFMT(YasiuPlayerLog, Verbose, "Updating camera rotation to: {0}", curRot.ToString());
}
void ABuilderPawn::HandlePanUnBound(const FInputActionValue& value)
{
FVector moveXY = MouseXYBindingValue->GetValue().Get<FVector>();
//MouseXYAction->bConsumeInput = true;
//MouseXYBindingValue->GetAction(); /// Consume
//MouseXYAction//->cons
//EnhancedInputComponent->Consum
//EnhancedInputComponent->ConsumeAction(Click);
MoveActor(moveXY);
}