Skip to main content
1-Visitor
September 14, 2021
Question

Arrow Navigator

  • September 14, 2021
  • 1 reply
  • 5700 views

I have a relatively large model and have made the experience that the user sees the important places (e.g. 3D img) simply over or can not find.

My idea would be a 3D model in the form of an arrow, this arrow should be fixed in front of the camera and always turn in the direction of the "important place (3D img)".

I have already seen in other articles that binding widgets in front of the camera is no problem e. g. https://community.ptc.com/t5/Vuforia-Studio/Finding-distance-from-the-model/m-p/647022 but how can I make this widget rotate in the direction of the "important place (3D img)"?

 

How can I implement such functionality? I am sure other users would also benefit from something like this. Thanks a lot in advance.

1 reply

21-Topaz I
September 15, 2021

Hello @Lucas ,

I think this will be possible using the eye tracking event of the device.  In the post "https://community.ptc.com/t5/Vuforia-Studio/Get-surface-coordinates-of-a-model/m-p/646408#M7459"  is demonstrated  how to received the current position of your device. The relevant code is this:

////////////////////////////////////
$rootScope.$on('modelLoaded', function() { 
 $scope.check_if_works=false
 //=====================
 // set some properties 
 //the next prop is important that the tracking event will use the callback
 $scope.setWidgetProp('3DContainer-1','enabletrackingevents',true);
 $scope.setWidgetProp('3DContainer-1','dropshadow',true);
 $scope.setWidgetProp('3DContainer-1','extendedtracking',true);
 $scope.setWidgetProp('3DContainer-1','persistmap',true);
 
 //====================
 $timeout($scope.setMyEYEtrack(), 2500) //call with delay 2.5 sec


});
/////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
$scope.setMyEYEtrack= function() {
 if(tml3dRenderer) 
 { 
 
 try {
tml3dRenderer.setupTrackingEventsCommand (function(target,eyepos,eyedir,eyeup) {
 
 var scale=2.0; //distance to eye
//moved the widget in regards of the new viewpoint position of the device
 $scope.setWidgetProp('3DImage-1', 'x', ( eyepos[0]+eyedir[0]*scale));
 $scope.setWidgetProp('3DImage-1', 'y', ( eyepos[1]+eyedir[1]*scale));
 $scope.setWidgetProp('3DImage-1', 'z', ( eyepos[2]+eyedir[2]*scale));
 $scope.$applyAsync();

 },undefined) } catch (e) { $scope.setWidgetProp('3DLabel-1', 'text', "exception=");}
 
}else 
 $scope.setWidgetProp('3DLabel-1', 'text', "null tml3dRenderer object on HoloLens");

} ////// finish setEYEtrack

The code shows one time what of the properties of 3d container widget should be set (better to set this manually  and not via JS)

Another point is that we move with the device aother widget which will update always its postion in relation to the device movement. 

In the article   https://community.ptc.com/t5/Vuforia-Studio/Finding-distance-from-the-model/m-p/647022  the distace was calculated as vector which is the diference between the eyepos vector and the modelWidget postion.  In your case  it (dirVec = yourWidgetPos - eyePosDevice) should be the postion of your widget what you want to follow with the arrow.  The location of the arrow will be easy to set   - something like    posVec + scale* dirVec    but it will be more difficult to calculate the correct angle to follow the direction. An easiare approach chould be to use instead dots /balls or e.g.  3 balls with different size which will be set in the object direction:

posBall1 =posVec + scale1* dirVec

posBall2 =posVec + scale2* dirVec

posBall3 =posVec + scale3* dirVec

so that the balls will point in the direction of the object

Lucas1-VisitorAuthor
1-Visitor
September 16, 2021

Thank you very much for your answer @RolandRaytchev. I think the approach with the balls is good. Unfortunately, I can not imagine how I should implement this. Can you send me an example experience?

21-Topaz I
September 16, 2021

I am will check if there is such example or will create one next couple of days  / for this post and the post https://community.ptc.com/t5/Vuforia-Studio/Distance-between-camera-and-model/m-p/748593#M10118 .