Hi, I find that the Stop All Camera Shakes
blueprint node cannot stop infinite camera shakes when disabling the Immediately
option for which I would like this node to blend-out my previously started infinite camera shake.
I use the following blueprint, which is very simple based on a trigger volume:
However, with this blueprint setup, I find the Stop All Camera Shakes
node does not work as expected. It cannot stop the camera shake. Then I dive into the code, and find something confusing for me to understand.
This node first calls the RemoveAllCameraShake(bool)
function:
CachedCameraShakeMod->RemoveAllCameraShakes(bImmediately);
This function then calls StopShake(bool)
for each ShakeInfo of active shakes:
ShakeInfo.ShakeInstance->StopShake(bImmediately);
Then this functionn calls Stop(bool)
:
// Make our transient state as stopping or stopped.
State.Stop(bImmediately);
// Let the root pattern do any custom logic.
if (RootShakePattern)
{
FCameraShakeStopParams StopParams;
StopParams.bImmediately = bImmediately;
RootShakePattern->StopShakePattern(StopParams);
}
Inside the Stop(bool)
function, a HasDuration()
function has dominated the whole code snippet, meaning that if current camera shake is infinite the Stop(bool)
function will never have the chance to execute, and hence the camera shake will never be interrupted.
bool FCameraShakeState::Stop(bool bImmediately)
{
if (HasDuration())
{
// If we have duration information, we can set our time-keeping accordingly to stop the shake.
// For stopping immediately, we just go to the end right away.
// For stopping with a "graceful" blend-out:
// - If we are already blending out, let's keep doing that and not change anything.
// - If we are not, move to the start of the blend out.
const float ShakeDuration = ShakeInfo.Duration.Get();
if (bImmediately || !bHasBlendOut)
{
ElapsedTime = ShakeDuration;
}
else
{
const float BlendOutStartTime = ShakeDuration - ShakeInfo.BlendOut;
if (ElapsedTime < BlendOutStartTime)
{
ElapsedTime = BlendOutStartTime;
}
}
return true;
}
return false;
}
I am curious about what this code snippet of RootShakePattern->StopShakePattern(StopParams)
does but unfortunately it seems to do nothing as StopShakePattern
is not actually implemented.
After I set the duration of my camera shake as a large number (say 9999), the blueprint node works! So I think it is this code snippet of FCameraShakeState::Stop(bool)
that makes everything go wrong.
Regarding what I have found above, I am still not absolutely sure if this is a bug, or I miss something that COULD make it work.