Animating our Unity model for HoloLens

Now that we have our basic model of the ABB 6620 industrial robot inside HoloLens, it’s time to make it move.

Tom Eriksson kindly provided some basic scripts to perform rotations on the various parts in the base model. I went ahead and consolidated these into a single “Rotate” script, with parameters (the speed, axis and min/max angles of the rotation) that vary depending on the part being rotated.

For instance, some parts can rotate freely around their main axis while others are physically constrained to move between certain angle limits. This is taken care of by the below C# script:

using UnityEngine;

using System.Collections;

public class Rotate : MonoBehaviour

{

    // Parameters provided by Unity that will vary per object

    public float speed = 50f; // Speed of the rotation

    public Vector3 axis = Vector3.up; // Axis of rotation

    public float maxRot = 170f; // Minimum angle of rotation (to contstrain movement)

    public float minRot = -170f; //…

Read more

Leave a Comment