Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

Interpolator (in HoloToolkit)

edited September 2016 in Questions And Answers

Hi all, I'm trying to get the interpolator script working and am having some trouble understanding it.
For instance if I wanted to move a cube from it's current position to a target position smoothly, where exactly would I attach the script and how would I call it?

I'm confident that I need to be working with:
public void SetTargetPosition(Vector3 target)

but am just not sure exactly what it looks like to send the Vector3 data to this script.

Thanks for any help!

EDIT:
Here is the interpolator script for those who haven't seen it

Tagged:

Answers

  • Options

    @seanicboom,
    You can attach the Interpolator script to your object in the Inspector or you can add it via code.

    I like to attach scripts in the Inspector to help me get an overview of what scripts each of my GameObjects use.

    Here is how I used it in a project I am developing:

    private void Awake()
    {
        interpolator = gameObject.GetComponent<Interpolator>();
    
        interpolator.PositionPerSecond = MoveSpeed;
        interpolator.SmoothLerpToTarget = true;
    
        interpolator.InterpolationStarted += Interpolator_InterpolationStarted;
        interpolator.InterpolationDone += Interpolator_InterpolationDone;
    }
    
    private void Interpolator_InterpolationStarted()
    {
        // Do any work required now that the object is in motion.
    }
    
    private void Interpolator_InterpolationDone()
    {
        // Do any work required now that the object has stopped moving.
    }
    
    public void Move()
    {
        Vector3 destination = GetDestination();
        interpolator.SetTargetPosition(destination);
    }
    

    Hope this helps!
    David

Sign In or Register to comment.