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

Simple move animation

Hi, I am new to Unity and have a question about animation. I just want to move a GameObject from point A to point B and would like the viewer to see the movement, what is the best way to do it?

Thank you very much.

Fireman

Comments

  • Options
    Jarrod1937Jarrod1937 ✭✭✭
    If it's not a skinned mesh (a skeletal animated object like a character), then a simple object.transform.position = new position would work. Though, as you've probably learned this instantly moves the object, thus you'll want to look into lerp, which will interpolate the instant movement into multiple frames so the player can see the movement.
  • Options

    Check out Rick Barraza's Creative Coding with Unity - it is the prefect introduction for Unity, and most of what you learn will be immediately applicable to HoloLens development as well.

  • Options
    evanjamesevanjames
    edited May 2016

    @vbandi Hi
    I am getting the below errors as I am trying to give command to one animation.
    I am new to coding and I was hoping you can give any input as to what I am doing wrong. Thank you

    I am getting the below errors

  • Options

    You have made several syntax errors. Here is what the Update method should look like:
    void Update()
    {
    if (Input.GetKeyDown("1"))
    anim.Play("idle", 1, 0f);
    }

    Pay attention to the placement of the semicolons and the {}.

  • Options
    Jarrod1937Jarrod1937 ✭✭✭
    edited May 2016

    I recommend never using the shorthand notation for if statements. Others may not be that strict, but my own code styling I always do this:

    void Update() { if (Input.GetKeyDown("1")) { anim.Play("idle", 1, 0f); } }

    That way you can easily link up opening and closing brackets (every open bracket must have a closing one), and it's easier to see what is referred to by the if statement. Just a suggestion, if you're new to coding, you'll want to explore different coding styles out there and adopt it for all your coding for consistency.

  • Options

    @Fireman for more complex animations and movements (sequences/easing/etc) you may want to check out Dotween. Its fantastic and free: http://dotween.demigiant.com/

    Taqtile

Sign In or Register to comment.