## ClipMatch

### Introduced

v3.0

### Description

Matches up two clips by determining the proper PoseOffset to use to have them match at the start of the second clip.

### Scripting Syntax

    ClipMatch( [InputObj] );

### Parameters

Parameter | Type | Description
--- | --- | ---
InputObj | String | List of exactly two clips to match up. Default Value: Current selection

### Examples

#### VBScript Example

    '
    ' Create a sphere and some paths for it to travel along.
    '
    set newSph = CreatePrim( "Sphere", "MeshSurface" )
    set crv1 = SICreateCurve( "crvlist", 3, 0 )
    SIAddPointOnCurveAtEnd crv1, -15, 0, 18, False
    SIAddPointOnCurveAtEnd crv1, -6, 0, 5, False
    SIAddPointOnCurveAtEnd crv1, -6, 0, -9, False
    SIAddPointOnCurveAtEnd crv1, -23, 0, -14, False
    set crv2 = SICreateCurve( "crvlist", 3, 0 )
    SIAddPointOnCurveAtEnd crv2, 25, 0, -5, False
    SIAddPointOnCurveAtEnd crv2, 14, 0, -4, False
    SIAddPointOnCurveAtEnd crv2, 5, 0, -9, False
    SIAddPointOnCurveAtEnd crv2, -4, 0, -10, False
    SIAddPointOnCurveAtEnd crv2, -11, 0, 4, False
    SIAddPointOnCurveAtEnd crv2, -3, 0, 10, False
    SIAddPointOnCurveAtEnd crv2, 7, 0, 8, False
    '
    ' Plot Actions of it moving along those paths (then delete the paths).
    '
    ApplyPath newSph, crv1, 1, 40, 2, True, True
    set act1 = PlotToAction( newSph, newSph & "/kine.local.posx,kine.local.posy,kine.local.posz,kine.local.rotx,kine.local.roty,kine.local.rotz", "plot", 1, 40, 1, 20, 3, False, 0.01 )
    DeleteObj crv1
    ApplyPath newSph, crv2, 1, 40, 2, True, True
    set act2 = PlotToAction( newSph, "sphere.kine.local.posx,sphere.kine.local.posy,sphere.kine.local.posz,sphere.kine.local.rotx,sphere.kine.local.roty,sphere.kine.local.rotz,sphere.kine.local.sclx,sphere.kine.local.scly,sphere.kine.local.sclz", "plot", 1, 40, 1, 20, 3, False, 0.01 )
    DeleteObj crv2
    '
    ' Put the Actions on the mixer, overlapping by a number of frames.
    '
    set trk1 = AddTrack( ActiveSceneRoot, , 0 )
    set trk2 = AddTrack( ActiveSceneRoot, , 0 )
    set clip1 = AddClip( ActiveSceneRoot, act1, , trk1, 20 )
    set clip2 = AddClip( ActiveSceneRoot, act2, , trk2, 40 )
    '
    ' Apply a character tag to indicate which object's transform to examine
    ' when determining the appropriate pose offset.  If you run ClipMatch
    ' non-interactively, you don't need this, you can just specify any "reference
    ' object" as the third-selected object.  A character tag is required
    ' when running the command interactively.
    '
    SelectObj newSph, , True
    TagObject newSph, "CenterOfGravity"
    '
    ' Run ClipMatch command, to determine the appropriate pose offset to
    ' apply to the "target" object, so that the reference object has the
    ' same global transform at the "match time".
    '
    ClipMatch clip1 & "," & clip2 & "," & newSph
    AddTransition clip1, clip2, 0
    SelectObj newSph, , True

### See Also

OffsetValueMap