arrow-left

All pages
gitbookPowered by GitBook
1 of 3

Loading...

Loading...

Loading...

Animate

AnythingWorld.AnythingAnimate.Animate

hashtag
Declaration

hashtag
Parameters

hashtag
Description

Allows you to send a model to be rigged and animated through Animate Anything directly through Unity. If the model is sent to be animated without error, an ID will be generated that can be used to poll the current progress of the model's animation process. This function is Editor only.

This function works from a direct reference to a game object. Please note that the model needs to be of a valid file type (.obj, .fbx, .dae, .gltf, or .glb). Any additional assets uploaded similarly need to be of a valid asset file type (a list of these valid file types, as well as additional constraints can be found ). The additional assets path must lead to a folder which contains the assets. Ensure that any paths used are relative paths to the Assets folder.

hashtag
Example


hashtag
Declaration

hashtag
Parameters

hashtag
Description

Allows you to send a model to be rigged and animated through Animate Anything directly through Unity. If the model is sent to be animated without error, an ID will be generated that can be used to poll the current progress of the model's animation process.

This function uses a path to reference the model. This path needs to be a direct path to the model, including its extension type. Please note that the model needs to be of a valid file type (.obj, .fbx, .dae, .gltf, or .glb). Any additional assets uploaded similarly need to be of a valid asset file type (a list of these valid file types, as well as additional constraints can be found ). The additional assets path, unlike the model path, must lead to a folder which contains the additional assets. Ensure that the paths used are absolute paths.

hashtag
Example

Poll

AnythingWorld.AnythingAnimate.Poll

hashtag
Declaration

hashtag
Parameters

public static void Animate(GameObject model, string modelName, string modelType, string authorName, string license, bool symmetrical, bool allowSystemImprovement, Action<string> onExport, Action<string, UnityWebRequest> onError)
public static void Animate(GameObject model, string modelName, string modelType, string authorName, string license, bool symmetrical, bool allowSystemImprovement, Action<string> onExport, Action<string, UnityWebRequest> onError, string additionalAssetsPath = "")

allowSystemImprovement

Flag asking if the user allows Anything World to use the model for internal improvements.

onExport

Function asking the user what to do once the model has been sent to be processed. String parameter outputs the ID of the model.

onError

Function to be executed if an error occurs in sending the model to be processed. String parameter outputs the ID of the model if one has been supplied, UnityWebRequest parameter contains the request details such as error codes and messages.

model

Reference to the model that should be rigged through Animate Anything.

modelName

The name of the model when accessed through My World.

modelType

The type of the model, as used when determining what skeleton to rig the model as (see the FAQ arrow-up-rightfor more details on what types are currently supported).

authorName

The name of the original author of the model.

license

The license attributed to the model.

symmetrical

Flag for determining if the model is symmetrical or not.

allowSystemImprovement

Flag asking if the user allows Anything World to use the model for internal improvements.

onExport

Function asking the user what to do once the model has been sent to be processed. String parameter outputs the ID of the model.

onError

Function to be executed if an error occurs in sending the model to be processed. String parameter outputs the ID of the model if one has been supplied, UnityWebRequest parameter contains the request details such as error codes and messages.

(additionalAssetsPath)

Path to a folder containing any additional assets separate from the original model. If no additional assets are necessary, this can be left empty.

modelPath

Path to the model that should be rigged through Animate Anything.

additionalAssetsPath

Path to a folder containing any additional assets separate from the original model. If no additional assets are necessary, this can be left empty.

modelName

The name of the model when accessed through My World.

modelType

The type of the model, as used when determining what skeleton to rig the model as (see the FAQ for more details on what types are currently supported).

authorName

The name of the original author of the model.

license

The license attributed to the model.

symmetrical

here
here

Flag for determining if the model is symmetrical or not.

public class MyTestScript : MonoBehaviour 
{
    public GameObject myModel;
    
    string myModelName = "My Model";
    string myModelType = "Human";
    string authorName = "Model Author";
    string myModelLicense = "MIT";
    bool myModelSymmetry = true;
    bool myModelUsedForImprovement = false;

    public void AnimateMyModel()
    {
        AnythingAnimate.Animate(
            myModel,
            myModelName,
            myModelType,
            authorName,
            myModelLicense,
            myModelSymmetry,
            myModelUsedForImprovement,
            PrintDebugWhenSuccessful,
            PrintDebugWhenFail)
    }
    // This function will be invoked if the model has successfully been sent to Animate Anything
    public void PrintDebugWhenSuccessful(string ID)
    {
        Debug.Log("Successfully sent my model to be animated!");
    }
    // This function will be invoked if an error was encountered in sending the file to Animate Anything
    public void PrintDebugWhenFail(string ID, UnityWebRequest error)
    {
        Debug.Log("Could not send my model to be animated!");
    }
}
public static void Animate(string modelPath, string additionalAssetsPath, string modelName, string modelType, string authorName, string license, bool symmetrical, bool allowSystemImprovement, Action<string> onExport, Action<string, UnityWebRequest> onError)
public class MyTestScript : MonoBehaviour 
{
    string myModelPath = "C:\Users\User\Desktop\MyModel.fbx"
    string myExtraAssetsPath = "C:\Users\User\Desktop\MyModelAssets"

    string myModelName = "My Model";
    string myModelType = "Human";
    string authorName = "Model Author";
    string myModelLicense = "MIT";
    bool myModelSymmetry = true;
    bool myModelUsedForImprovement = false;

    public void AnimateMyModel()
    {
        AnythingAnimate.Animate(
            myModelPath, 
            myExtraAssetsPath,
            myModelName,
            myModelType,
            authorName,
            myModelLicense,
            myModelSymmetry,
            myModelUsedForImprovement,
            PrintDebugWhenSuccessful,
            PrintDebugWhenFail)
    }
    // This function will be invoked if the model has successfully been sent to Animate Anything
    public void PrintDebugWhenSuccessful(string ID)
    {
        Debug.Log("Successfully sent my model to be animated!");
    }
    // This function will be invoked if an error was encountered in sending the file to Animate Anything
    public void PrintDebugWhenFail(string ID, UnityWebRequest error)
    {
        Debug.Log("Could not send my model to be animated!");
    }
}

Function asking the user what to do once the model has finished processing. ModelJson parameter contains the necessary details to create the model using .

onProcessFail

Function asking the user what to do if an error occurs whilst processing. First string parameter contains the error code. Second string parameter contains the error message.

onProcessPoll

Function asking the user what to do whilst processing. First string parameter contains the current output code. Second string parameter contains the message. The int parameter accounts for how many seconds the model has been processing for.

id

The ID of the model to poll.

(timeout)

The amount of time in seconds before the polling times out. Standard timeout is set to 10 minutes.

hashtag
Description

Allows you to poll for a model's current state in the Animate Anything processing pipeline. This polls continuously until the model either produces a failure or a successful result.

hashtag
Example

onProcessFinished

AnythingAnimate

AnythingWorld.AnythingAnimate

hashtag
Static Methods

Allows the user to send a model to be rigged and animated through Animate Anything directly through Unity.

Allows the user to poll for a model's current state in the Animate Anything processing pipeline.

hashtag
Description

A class that provides methods for interfacing with Animate Anything directly in Unity.

hashtag
Example

public static void Poll(Action<ModelJson> onProcessFinished, Action<string, string> onProcessFail, Action<string, string, int> onProcessPoll, string id)
public static void Poll(Action<ModelJson> onProcessFinished, Action<string, string> onProcessFail, Action<string, string, int> onProcessPoll, string id, int timeout)
public class MyTestScript : MonoBehaviour 
{
    string myModelID = "416e797468696e67476f6573";

    public void PollMyModel()
    {
        AnythingAnimate.Poll(
            PrintDebugWhenSuccessful,
            PrintDebugWhenFail,
            PrintDebugWhenPoll,
            myModelID);
    }
    
    // This function will be invoked if the model has successfully been animated by Animate Anything
    public void PrintDebugWhenSuccessful(ModelJson details)
    {
        Debug.Log("Model successfully animated!");
    }
    
    // This function will be invoked if an error was encountered in animating the model
    public void PrintDebugWhenFail(string code, string message)
    {
        Debug.Log("Could not animate model!");
    }
    
        // This function will be invoked whenever the model is polled for
    public void PrintDebugWhenPoll(string code, string message, int seconds)
    {
        Debug.Log("Polling for update on my model!");
    }
}
AnythingMaker.Make
Animate
Poll
public class MyTestScript : MonoBehaviour 
{
    string myModelPath = "C:\Users\User\Desktop\MyModel.fbx"
    string myExtraAssetsPath = "C:\Users\User\Desktop\MyModelAssets"

    string myModelName = "My Model";
    string myModelType = "Human";
    string authorName = "Model Author";
    string myModelLicense = "MIT";
    bool myModelSymmetry = true;
    bool myModelUsedForImprovement = false;

    private void Start() 
    {
        AnimateMyModel();
    }

    public void AnimateMyModel()
    {
        AnythingAnimate.Animate(
            myModelPath, 
            myExtraAssetsPath,
            myModelName,
            myModelType,
            authorName,
            myModelLicense,
            myModelSymmetry,
            myModelUsedForImprovement,
            PollMyModel,
            PrintDebugWhenAnimateFail)
    }
    
    // This function will be invoked if the model has successfully been sent to Animate Anything
    public void PollMyModel(string ID)
    {
        AnythingAnimate.Poll(
            PrintDebugWhenPollSuccessful,
            PrintDebugWhenPollFail,
            PrintDebugWhenPoll,
            ID);
    }
    
    // This function will be invoked if the model has successfully been animated by Animate Anything
    public void PrintDebugWhenPollSuccessful(ModelJson details)
    {
        Debug.Log("Model successfully animated!");
        AnythingMaker.Make(details);
    }
    
    // This function will be invoked if an error was encountered in animating the model
    public void PrintDebugWhenPollFail(string code, string message)
    {
        Debug.LogError("Could not animate model!");
    }
    
    // This function will be invoked whenever the model is polled for
    public void PrintDebugWhenPoll(string code, string message, int seconds)
    {
        Debug.Log("Polling for update on my model!");
    }
    
    // This function will be invoked if an error was encountered in sending the file to Animate Anything
    public void PrintDebugWhenAnimateFail(string ID, UnityWebRequest error)
    {
        Debug.LogError("Could not send model to be animated!");
    }
}