πŸ”ΈWarp Providers

In this section you will learn about warp providers.

Technical Aspects

Warp Providers are components that provide active interaction with target points.

circle-check

This plugin offers a common interface - IWarpProvider - that can be used to create custom Warp Providers. This interface contains a single method called Interact that returns the result of a check:

WarpProviderInterface.cs
public struct WarpInteractionResult
{
    public WarpPoint[] points;            // Target points.
    public MotionWarpingAsset asset;      // Warping asset with settings.      
    public bool success;                  // If the interaction can be started.

    public bool IsValid()
    {
        return success && points != null && asset != null;
    }
}
    
public interface IWarpPointProvider
{
    public WarpInteractionResult Interact(GameObject instigator);
}

The plugin supports both moving and static obstacles out of the box. Here is how to correctly pass the data for each obstacle type:

chevron-rightMoving obstacleshashtag

To make the Warp Point depend on a specific transform, make sure to specify that target transform, and convert the point world coordinates to that transform's space:

chevron-rightStatic obstacleshashtag

If you want the Warp Point to be static in world space, make sure to pass the world coordinates of the desired interaction point:

Example

Here is how to use a Warp Provider in code. We are going to use VaultComponent in this example:

It is also possible to pass the gameObject as a parameter in the Interact method:

In this case, the Motion Warping will try to get the first component that implements the IWarpProvider interface and interact with it.

Last updated