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

Tagalong menu position

I've attached Tagalong script to a canvas with several buttons. advice needed for these 2 issues:

  1. canvas sometimes still sinks into other holograms instead of moving in front of hologram. most of the time canvas will slowly emerge to front of hologram when collision is detected. any way to prevent it from sinking or make it hover over other holograms faster?

  2. how do I keep the canvas to always stay at the bottom of FOV?

thx :smile:

Tagged:

Answers

  • Options
    ahillierahillier mod
    edited October 2016

    @felsiska,
    1. Ensure that all of your holograms have colliders. TagAlong's raycast won't detect these objects if they do not have colliders.
    2. In 'SimpleTagAlong.cs' you should be able to modify the resulting frustumPlanes object to only cover the lower part of the camera frustum:
    frustumPlanes = GeometryUtility.CalculateFrustumPlanes(Camera.main);

  • Options

    Additionally, if you aren't using SimpleTagalong, you can increase HorizontalRayCount and/or VerticalRayCount to increase the likelihood that one of the TagAlong's Raycasts will hit your other hologram(s).

  • Options
    felsiskafelsiska
    edited October 2016

    @ahillier @timg
    i am only using Tagalong as i want it to be in front of all objects. how can i implement the locking of position to bottom of frustum in Tagalong.cs? i'm also not sure how to edit
    frustumPlanes = GeometryUtility.CalculateFrustumPlanes(Camera.main); to lock it only to bottom.

    thx for previous advices

  • Options
    timgtimg mod
    edited October 2016

    You'll probably want to implement your own class that derives from Tagalong or SimpleTagalong and in that class, override CalculateTargetPosition. In that method, you should adjust frustumPlanes[frustumTop] by moving it down, thus forcing your tagalong to resolve its targeted position in the lower portion of the frustum. then, call base.CalculateTargetPosition.

    I've not tried this myself, but the approach seems sound.

  • Options
    ctsholoctsholo
    edited October 2016

    @timg What you mean by moving it down?. Why do all you guys leave everything to suspense .
    @timg > @timg said:

    In that method, you should adjust frustumPlanes[frustumTop] by moving it down, thus forcing your tagalong to resolve its targeted position in the lower portion of the frustum. then, call base.CalculateTargetPosition.

    >

  • Options
    timgtimg mod
    edited October 2016

    frustumPlanes is filled in by GraphicsUtility.CalculateFrustumPlanes(). By moving it down, I mean to shrink the area Tagalong has to play with by taking the frustomTop plane and moving it down. See the pictures here to help visualize what you are trying to do.

    Like I said above, I've note tried this myself, but the approach seems sound. You'll probably need to implement these steps:
    1. Find a point on the plane.
    2. Calculate a new point along the plane's normal.
    3. Use SetNormalAndPosition() to update frustumPlanes[frustumTop].

    edit - updated steps that match the code below
    1. Find a point in front of the camera
    2. Redefine frustumPlanes[frustumTop] with that point and the original normal for the plane

  • Options

    Here's some actual code to get you started...

    using UnityEngine;
    using HoloToolkit.Unity;
    
    public class MyTagalong : Tagalong
    {
        protected override bool CalculateTagalongTargetPosition(Vector3 fromPosition, out Vector3 toPosition)
        {
            // restrict the Tagalong to use the lower-half of the
            // view frustum
    
            // Find a point in front of the camera
            Vector3 point = Camera.main.transform.position + Camera.main.transform.forward * TagalongDistance;
    
            // redefine the top plane so it intersects with that point
            frustumPlanes[frustumTop] = new Plane(frustumPlanes[frustumTop].normal, point);
    
            // call the base implementation to do the work
            return base.CalculateTagalongTargetPosition(fromPosition, out toPosition);
        }
    }
    
    
Sign In or Register to comment.