MultiWorld  1.1.0
Manage multiple isolated UWorld instances simultaneously in Unreal Engine, transferring player and actors between worlds.
Public Member Functions | List of all members
UMultiWorldSeamTransition Class Reference

Helper class to make a seam transition between two worlds, driving a customizable graphics effect. More...

#include <MultiWorldSeamTransition.h>

Inheritance diagram for UMultiWorldSeamTransition:

Public Member Functions

virtual TStatId GetStatId () const override
 
virtual void Initialize (FSubsystemCollectionBase &Collection) override
 
bool IsInTransition () const
 Checks if a transition is still running. More...
 
virtual bool IsTickable () const override
 
void SetDefaultFXLayerZOrder (int32 ZOrder)
 Set the ZOrder value used by the widget showing the transition VFX. More...
 
bool StartTransition (UObject *WorldContextObject, FMultiWorldHandle InDestinationWorldHandle, UMaterial *TransitionMaterial, const FOnTransitionEnd &OnTransitionEnd, float DurationInSeconds=1.0f, float WorldSwitchNormalizedTime=0.5f, bool bForceWorldsTickingDuringTransition=true, bool bAutoHandleAudioFade=true)
 Start a seam visual transition that brings the player to a new world. More...
 
virtual void Tick (float DeltaTime) override
 

Detailed Description

Helper class to make a seam transition between two worlds, driving a customizable graphics effect.

Member Function Documentation

◆ IsInTransition()

bool UMultiWorldSeamTransition::IsInTransition ( ) const

Checks if a transition is still running.

◆ SetDefaultFXLayerZOrder()

void UMultiWorldSeamTransition::SetDefaultFXLayerZOrder ( int32  ZOrder)

Set the ZOrder value used by the widget showing the transition VFX.

Parameters
ZOrderThe new ZOrder value to use. The higher the number, the more on top the widget will be.

The new value will be effective on the next call of StartTransition().

◆ StartTransition()

bool UMultiWorldSeamTransition::StartTransition ( UObject *  WorldContextObject,
FMultiWorldHandle  InDestinationWorldHandle,
UMaterial *  TransitionMaterial,
const FOnTransitionEnd &  OnTransitionEnd,
float  DurationInSeconds = 1.0f,
float  WorldSwitchNormalizedTime = 0.5f,
bool  bForceWorldsTickingDuringTransition = true,
bool  bAutoHandleAudioFade = true 
)

Start a seam visual transition that brings the player to a new world.

Parameters
[in]WorldContextObjectWorld context object.
[in]InDestinationWorldHandleDestination world handle.
[in]TransitionMaterialThe material used by the visual transition. Read the notes below for details.
[in]OnTransitionEndCallback called when the transition ends.
[in]DurationInSecondsTransition duration in seconds. Must be not negative.
[in]WorldSwitchNormalizedTimeNormalized time in [0, 1] used to control when the world switching is performed (i.e. when UMultiWorldStatics::SwitchWorld() is called). For example, with WorldSwitchNormalizedTime = 0.5f the switch is performed at the middle of the transition; with WorldSwitchNormalizedTime = 1.0f the switch is performed at the end of the transition.
[in]bForceWorldsTickingDuringTransitionif true, the ticking is forced for both worlds involved for the transition duration.
[in]bAutoHandleAudioFadeif true, then the audio fade-in/out between the two worlds is handled automatically. It requires that each of the involved worlds have a dedicated audio device.

Only one active transition can run at a given time, otherwise the call will fail returning false.

Transition Material

The effect uses a Material to drive the visual transition. This material must complies to some requirements:

  • the Material Domain property MUST be set to User Interface;
  • you can use the Material Function MultiWorld_SeamTransition_MF to access the information needed to mix the two rendered worlds (like the current animation factor, the sampled colors from the source and destination worlds, etc).
SeamTransitionMaterial.png
A simple cross-fading transition effect

The plugin provides some ready-to-use materials (e.g. MW_ST_CrossFading_PPM, MW_ST_WipeLeftToRight_PPM, etc.), that you can use as-is or analyze to create your custom ones.

HUD and UMG widgets

HUD and UMG widgets of the switching worlds are not visible during the transition. If you want them to gently disappear/appear on screen, you must manually take care of it (e.g. animating their opacity) before starting the transition and when the transition ends (see the OnTransitionEnd parameter).

Returns
true if the transition is started.

The documentation for this class was generated from the following file: