have a scene with 4 Cinematic Sequence Devices. I am using a simple verse script to randomly choose one of these devices to play. When the sequence ends, a new device is randomly picked to play, and so on.
Issue is that there is a small frame glitch as one device finishes and another starts. The camera glitches back to the player camera for a moment.
Is there a way to remedy this?
I tried extending my sequences both before and after the active frame range in each sequence, but it did not help.
Steps to Reproduce
1.) Create anew project using the blank template.
2.) Place a few objects of interest in your scene.
3.) Create 2-4 Sequences, each pointing the camera at a difference object of interest.
4.) Create 2-4 Cinematic Sequence devices, each one referencing a different sequence. (not looping)
5.) Write a verse script that subscribes to the OnStopped event of the Cinematic Sequence Device. The script must then pick a new Cinematic Sequence Device to trigger.
Expected Result
Transition from each Cinematic Sequence Device is instantaneous and seamless.
Observed Result
There is a short, jolting glitch where the camera is momentarily possessed by the player pawn before the next Cinematic Sequence Device takes over.
A fix for this that I’ve used is to manually stop the sequence right before the end frame. This way you’re essentially starting the next sequence before the last one finishes.
Try something like this, hope it helps:
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Random }
sequence_hitch_fix := class(creative_device):
@editable
Sequences : []custom_animation_sequence = array{}
OnBegin<override>()<suspends>:void=
# Initialization
# Set the duration of the sequences
for(Sequence : Sequences):
Sequence.SetSequenceTime()
# Loop random sequences
loop:
if(SequenceToPlay := Sequences[GetRandomInt(0, Sequences.Length - 1)]):
SequenceToPlay.PlaySequence()
custom_animation_sequence := class<concrete>():
# The cinematic sequence device
@editable
CinematicSequenceDevice : cinematic_sequence_device = cinematic_sequence_device{}
# The offset to use for sequences
PlaybackOffset : float = 0.1
# Store the duration of the sequence in seconds
var SequenceDuration : float = 0.0
# Play the sequence
PlaySequence()<suspends>:void=
CinematicSequenceDevice.Play() # Play the sequence
Sleep(SequenceDuration - PlaybackOffset) # Sleep for the duration of the sequence
CinematicSequenceDevice.GoToEndAndStop() # Cut the sequence short (somehow this prevents the hitching)
# Sets the sequence time by skipping to end of the animation and getting the playback time.
SetSequenceTime():void=
# Play the sequence and skip to the end frame
CinematicSequenceDevice.Play()
CinematicSequenceDevice.GoToEndAndStop()
# Set the sequence duration as the current playback time
set SequenceDuration = CinematicSequenceDevice.GetPlaybackTime()
This is so helpful. How can I stop/start the loop or is this just a never-ending loop? Any help with being able to control this loop with a on/off switch would be amazing. Thanks
You can toggle playback with the TogglePause function on the cinematic sequence device:
# Store a reference to the active sequence so it can be paused
var ActiveSequence : custom_animation_sequence = custom_animation_sequence{}
# An event that signals the active sequence to pause
PauseSequenceEvent : event() = event(){}
OnBegin<override>()<suspends>:void=
# Initialization
# Set the duration of the sequences
for(Sequence : Sequences):
Sequence.SetSequenceTime()
# Loop random sequences
sync:
block:
loop:
if(SequenceToPlay := Sequences[GetRandomInt(0, Sequences.Length - 1)]):
set ActiveSequence = SequenceToPlay
# Play the sequence
ActiveSequence.PlaySequence()
block:
loop:
# Wait for the toggle pause event
PauseSequenceEvent.Await()
# Toggle the playback of the sequence
ActiveSequence.CinematicSequenceDevice.TogglePause()
If you wanted to cancel the playback you could do something similar with a race condition and GoToEndAndStop.