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

Correctly indicate Objects behind User

Im using the DirectionIndicator Script to lead Users to different Boxes that are out of their FoV (Field of View) and either in front or behind him. To do this I use an Arrow and a Line made with LineRenderer that connects the Point where the Cursor is with the Position of the Box searched for.
When the Box is behind the User the Arrow and the Line often point upwards or downwards (if the User is looking at the ground) because this is the shortest Vector.
What I personally want the Arrow and Line to do in this case is to point to the right/left and point slightly up/down dependent on the y-Variable of the Box behind.
The Reason for this is that the natural way to move if you want to get the Box inside your FoV is to turn left/right and not to turn the head 180° or more along the vertical axis which isn't even possible.
My thought right now is to create some artificial points the line has as an TargetPoint and Update it every frame so the line will point to the left/right side and never point directly upwards when the next Box is behind the User. That's pretty hard to do since you have to update the Point every Frame because you don't want the Line to lead to a Point in Space that is different to the Box and I also want it to indicate if it is higher or lower than the current CursorPosition while pointing left/right.
If anyone got an Idea how to do this I'd greatly appreciate it.
Thanks in advance!

Tagged:

Answers

  • Options

    You should be using the DIrectionIndicator.cs script in the HoloToolkit to do this. It can be found in the HoloToolkit under Utilities/Scripts subdirectory. It does exactly what you are looking for, without you having to roll your own solution.

  • Options
    trzytrzy ✭✭✭
    If I understand correctly, he is using it.

    I believe what he wants is an indicator that only points left/right until the target is in front of the user, at which point the indicator would then smoothly begin to incorporate a vertical direction.

    This could be a bit tricky to nail down correctly for weird corner cases like obnoxious users gazing down at their feet or up at the ceiling. But in general, I would try the following: define a horizontal field of view at least as large as the actual display FOV but maybe larger. The vertical extents would be infinite (a 180 degree vertical FOV, conceptually). You can envision this as just the left and right frustum planes.

    Now, when the target is outside this horizontal FOV, you only indicate left/right but when it enters the FOV, you turn on the vertical component and your arrow starts to also point up and down.

    You should probably do some fancy LERPing to make this transition smooth. You could also define a function that smoothly activates the vertical component of the direction indicator based on the horizontal angle from camera forward. This function should be 1 when within the real FOV and gradually fall off to 0 by the time it hits the edge of your wider "virtual" FOV.

    Just some ideas... you'll have to do the math yourself. But what could be more fun than that? :)

    By the way, a question of my own: does DirectionIndicator push the cursor to the edge of the display (the "screen edge" nearest the target)? I ended up rolling my own because I didn't know this existed. Mine pushes to the edge of the screen, which is I think what most people would want anyway, and includes optional tagalong-like behavior.
  • Options

    @Jesse_McCulloch Yes i'm already using that Script and only slightly modified it to better suit my case.

    @trzy Thanks for the very long and detailed answer! :smile:
    As you can see in my third picture I want it (if possible) to incorporate the vertical direction even when the Box is not in front the User.
    Using a function that smoothly activates the vertical component therefore sounds like a great idea.
    The main Problem is still also letting the Line point correctly at any given time since I have to update the TargetPoint of the Line in every frame to never make the User feel like the line is leading to another point in space than the box itself while also having it point in exactly the same direction as the Arrow.

    When using the DirectionIndicator Script your Cursor will stay in the middle of your FoV like normally and the Indicator will be positioned at the same location. There is also another Script called HeadsUpDirectionIndicator that displays the Indicator at the edge of the screen. I hope this answers your question?

  • Options
    trzytrzy ✭✭✭
    Thanks, @Andoelo ! I'll look into it. In the meantime, try my script and see if it works for you. I think it might do what you want.

    It's a pretty rough work in progress and has some modes that make no sense (I've got a simplified version in my local branch that I'll push when complete). Check out https://github.com/trzy/hololens/tree/master/Game-Helicopter

    GuidanceArrow is the object.

    There's a test scene with a cube that the arrow points to. It starts off in the wrong state but walk around a little and you'll see. In the Unity editor, you can walk around using WASD keys and the arrow keys turn and look up/down.

    If this is the behavior you are looking for, I can write up the logic here. It may need to be reimplemented in cleaner/simplified form.
  • Options
    trzytrzy ✭✭✭

    Whoops! Never mind. I just tried the HeadsUpDirectionIndicator and realized it behaves identically to the one I wrote independently! This is not the behavior you want. Mine is a bit simpler in that it just projects onto the HUD plane.

    I see a lot of flickering with the HoloToolkit one, too. Not sure what that's all about. It seems like it often disappears.

  • Options

    What I do right now is using an artificial "midpoint" that my line is targeting and is located at Z=0 while the boxes are either Z=2 (in front) or Z=-2 (behind). While my cursor is moving closer to the original position of the "midpoint" the new position of this "midpoint" changes to become more and more similar to the point where the next box is located by moving along the vector between those 2 points. I do this because otherwise the user would see the line in their FoV leading to some point in space different to the searched box.
    Calculating this "midpoint" correctly at any time works perfectly fine but while my cursorPosition and startingPoint of the line for example is at (-0.5, 1, 1) and the endPoint that my line and arrow are targeting is at (-1, 0, -0.5) the arrow and the line are turned slightly upwards although the second point's y-Variable is obviously 1 lower and I would expect it to be turned downwards.
    Anyone knows why the line and arrow are both pointing slightly upwards although the targetPoint is lower?

Sign In or Register to comment.