Animation Action

In this tutorial we will learn how to create and use an Animation Action and its components.
To generate an Animation Action you only need the Animation Move Prefab Constructor

Animation Prefab Constructor

From the MAGES menu select the option Create Prefab/Animation Prefab Constructor


The template gameObject for the animation prefab constructor will appear. It is recommended to use this object for your Animation Action. The Animation Prefab Constructor has 3 child objects;

  1. Animation Part

  2. Interactable Part (Child of Animation Part)

  3. End of Interactable

  • The Animation Part is used to map the animation with the user’s hand movement.

  • The Interactable Part is used to interact with the object

  • The End of Interactable is used to set the finishing point of the animation. When the Animation Part has the same position as the End of Interactable, then the Animation Action will be performed. We will get on that later on the tutorial.

The image below shows the gameobject that were referenced above.


So, let us begin creating our first animation action prefab.

Configuration of the interactable part

The configuration of the interactable part is pretty easy and straightforward. We will edit two scripts: - The Ovid VR Interactable Item - The Configure Child Movement

In the Ovid VR Interactable Item we simply drag and drop the Interactable Part gameObject from the scene to the Rigidbody field of the script.
This will give access to the gameObject’s rigidbody.
In the Configure Child Movement , drag and drop the Interactable Part gameobject form the scene to the Interactable Item field of the script.
Then, we will change the Translation Limit and the Translation - Rotation Motions
In the Translation Limit we set the acceptable movements in the XYZ axis
In the Translation - Rotation Motions we set the acceptable rotation motions in the XYZ axis.
In our example, we will Allow the X Movement, and we will set the everything except the X Movement Motion to Locked

Below, you can see how we configured both the OvidVRInteractableItem script and the ConfigureChildMovement script


Configuration of the gameobject mesh

First and foremost, we have to find our model prefab that we want to animate. In our case, we will use the “B_J_Base animation” prefab. Our prefab has already an animator component embedded with a controller named B_J_Base. The model of the prefab is an auxiliary plug model. Set the prefab as a child of the “Animation Part” GameObject.

Setting the plug as a child object of the Animation Part

Your last step of model configuration is creating a box collider as a child gameobject of the Interactable Part. The box collider should encapsulate all the plug mesh.

Lastly, we should also move the End of Interactable gameobject to the final location of the animation. In our case the last point of the animation is when x = 0.0627.

Now, let’s continue our tutorial by editing the Animation Move Prefab Constructor.

Animation Move Prefab Constructor

Here we will showcase how to use the Animation Move Prefab Constructor in the Animation Prefab Constructor.

The important fields of the Animation Move Prefab Constructor are:
1) Animation Name with a type of string
2) Start Game Object with a type of GameObject
3) End Game Object with a type of GameObject
4) Animation Reference with a type of GameObject

You can see the above fields in the picture below.

The important fields of the Animation Move Prefab Constructor

The above fields will be used in this tutorial to create a simple animation action! (For the explanation of each field please click here.)

Now let’s fill the above fields:

  • For the Animation Name we will put PlugInAnimation. It is a simple animation in the X axis.

  • After that, in the “Start Game Object” we put the Interactable Part.

  • In the “End Game Object” we put the End of Interactable.

  • For the “Animation Reference” we put the B_J_Base gameobject.

  • Lastly, for the “Target Percentage”, let’s set it to 0.922.

Filling the Animation Constructor


Below you can see the Animation Action.

Showcase Animation Action