Hi,
Yesterday night I had a good RTS Camera. When clicking the middle mouse button, and then moving the mouse on the X Axis, you could rotate the camera (according to the controller), so the camera will always be facing forward.
As any other programmer, I woke up to a different reality and now it does change the controller rotation (as the forward vector direction is changed), but the camera stays put.
AGameCamera::AGameCamera(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
springArm = ObjectInitializer.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("cameraBoom")); //Init springArm
springArm->AttachParent = RootComponent;
springArm->bUsePawnControlRotation = false;
springArm->bAbsoluteRotation = false;
springArm->TargetArmLength = 1000.0f;
springArm->RelativeRotation = FRotator(-60.f, 0.f, 0.f); springArm->bDoCollisionTest = false;
}
void AGameCamera::Rotate_Implementation(float Rate)
{
if (bCanRotate) //if rotation is possible- Middle Mouse Button is pressed
{
AddControllerYawInput(Rate); //Add to the Yaw Rotator the rate, coming in from the mouse movement on its X Axis
}
}
Does anyone see the problem?
Thanks.