Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. And always feel free to hit us up on Twitter @MxdRealityDev.

Having Hard Time To Handle Cursor Icon Whle Plcng Modal From One Place To Another In the Enviornment

edited August 2016 in Discussion

Hi, I have a model named as "cover" which have many child gameobject including toolbbar.
Its basically a book modal along with action bar.

There is an option (3rd one from left) which is being used for dragging purpose. I applied taptoplaceparent.cs script to drag model from one location to another.

using UnityEngine;

public class TapToPlaceParent : MonoBehaviour
{
bool placing = false;
public GameObject bookCover;

void OnSelect()
{
    Debug.Log("drag function called");
    // On each Select gesture, toggle whether the user is in placing mode.
    placing = !placing;

    // If the user is in placing mode, display the spatial mapping mesh.
    if (placing)
    {
        SpatialMapping.Instance.DrawVisualMeshes = true;
    }
    // If the user is not in placing mode, hide the spatial mapping mesh.
    else
    {
        SpatialMapping.Instance.DrawVisualMeshes = false;
    }
}

// Update is called once per frame
void Update()
{
    // If the user is in placing mode,
    // update the placement to match the user's gaze.

    if (placing)
    {
        // Do a raycast into the world that will only hit the Spatial Mapping mesh.
        var headPosition = Camera.main.transform.position;
        var gazeDirection = Camera.main.transform.forward;

        RaycastHit hitInfo;
        if (Physics.Raycast(headPosition, gazeDirection, out hitInfo,
            30.0f, SpatialMapping.PhysicsRaycastMask))
        {
            // Move this object's parent object to
            // where the raycast hit the Spatial Mapping mesh.
            //  this.transform.parent.position = hitInfo.point;
            var pt = hitInfo.point;
            pt.z = bookCover.transform.position.z;
            bookCover.transform.position = pt;
            // Rotate this object's parent object to face the user.
            Quaternion toQuat = Camera.main.transform.localRotation;
            toQuat.x = 0;
            toQuat.z = 0;
            // this.transform.parent.rotation = toQuat;
            //bookCover.transform.rotation = toQuat; 
        }
    }
}

}

So when I click on drag button spatial mapping on and I am able to drag cover model along with action bar (action bar is also an child object of cover gameobject, ) but having hard time to getting cursor back on drag button, because I have to tap again on drag button to place on my desired location.

How can I achieve this please?
Following is the snapshot for gameobject hierarchy.

Please check the attached swf files (download and open in browser to watch the video) for emulator and unity3d gameobjects respectively.
https://www.dropbox.com/s/twr5a637vn1wkrv/unity_2016-08-31_1523.swf?dl=0
https://www.dropbox.com/s/1iv0vxcxgz3jonf/Video_2016-08-31_1520.swf?dl=0

Can any one please suggest a feasible way to resolve the issue.?
I am looking forword for the quick response and discuss possible changes.

Answers

Sign In or Register to comment.