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

How do I make an object slowly come into the scene?

Hi guys,

I'm a beginner. Now I'm programming a demo to show how you need to assamble a part. I want to show the part and then make it slowly move to the defined position.
How can I do it?

This is what I got now but it's to fast and not smooth

public void Update()
{
if (stepCountUp == 1)
{
while (GameObjects[0].transform.position.x >= -2)
{
Time.timeScale = 0.000000000000001f;
GameObjects[0].transform.Translate(new Vector3(-2f, 0, 0) * speed * Time.deltaTime);

        }


    }
}

Best Answer

  • Options
    JimRodrJimRodr
    Answer ✓

    Vector3 spot = Vector3.MoveTowards(transform.position, idealLocation, 0.01f);
    transform.position = spot;

    I have had good success using MoveTowards to have objects slowly go from where they are to where I want them to end up. The third parameter is how much to move and can be calculated using a desired speed * Time.DeltaTime to be more precise/move smoother than a constant like 0.01f does.

Answers

  • Options

    This is probably a question that is more for the unity forum I am afraid.

  • Options
    JimRodrJimRodr
    Answer ✓

    Vector3 spot = Vector3.MoveTowards(transform.position, idealLocation, 0.01f);
    transform.position = spot;

    I have had good success using MoveTowards to have objects slowly go from where they are to where I want them to end up. The third parameter is how much to move and can be calculated using a desired speed * Time.DeltaTime to be more precise/move smoother than a constant like 0.01f does.

Sign In or Register to comment.