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

Trying to build a puzzle style engine?

HoloAtariHoloAtari
edited February 2017 in Questions And Answers

So what I am trying to do is to build an engine by moving holograms into their correct possitions.
I have 2 engines with 10 pieces each:
One which is assembled but its render its turned off.
Another one which is dismanteled into pieces, which you can pick up drag and drop to their correct position.
I have a working script for pc that when you drag the piece to its corresponding possition and it detects that is within the range of the radio of the piece that its render its turned off, the dragged piece gets destroyed and the hidden piece appears, giving the effect of snaping into its correct position.
Some how, this does not work with the HoloLens.
I have given the world anchor component to the base where everything is built uppon, but it still doesent respond to the pieces that i am moving getting into range of the hidden pieces. Any help will be apreciated.

2 scripts, one that makes the piece appear:

public GameObject objectD;
public GameObject objectO;
public AudioSource clickSound;

public float radio = 15f;
public Renderer rend;

// Use this for initialization
void Start () {
    rend = GetComponent<Renderer> ();
    rend.enabled = false;


}

// Update is called once per frame
void Update () {

    if (Vector3.Distance (this.transform.position, objectD.transform.position) <= radio && Input.GetMouseButtonUp(0)) {
        rend.enabled = true;
        //GameManager.IncreaseScore (1);
        clickSound.Play();
    }
}

One that destroys the draggable piece:

public GameObject objectD;
public GameObject objectO;
Vector3 originalPosition;

public float radio = 15f;

// Use this for initialization
void Start () {

    originalPosition = gameObject.transform.position;
}

// Update is called once per frame
void Update () {

    if (Vector3.Distance (this.transform.position, objectO.transform.position) <= radio && Input.GetMouseButtonUp(0)) {
        Destroy (this.gameObject);
    }
    if (Vector3.Distance (this.transform.position, objectO.transform.position) >= radio && Input.GetMouseButtonUp(0)) {
        gameObject.transform.position = originalPosition;
    }
}

I have tryed changing the Input.GetMouseButtonUp(0)) but nothing seems to work

This works on the PC.

Thank you for your help.

Sign In or Register to comment.