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;
Interactable Part (Child of Animation Part)
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
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.
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.
You can see the above fields in the picture below.
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.
Below you can see the Animation Action.