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.

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.