cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Dynamically create widget in hololens

BC_10971006
6-Contributor

Dynamically create widget in hololens

I want to dynamically create a 3dImage widget from HoloLens to javascript.

 

```javascript

tml3dRenderer.add3DImage({ id:"testimg",src: "app/resources/Uploaded/testimg.png", x:xPosition,y:yPosition,z:zPosition, rx:"0" });

```


So I used these codes. In preview, they were created in the right place normally. However, within the actual HoloLens view app, the image was created, but the locations were 0, 0, 0. After debugging inside HoloLens, the tml3dRender.add3Dimage function contains x, y, and z values as parameters, but the function inside the HoloLens does not contain x, y, z as parameters.

 

``` javascript

//in preview 

this.add3DImage = function (...args) {
/* eslint-disable no-unused-vars */
let tracker,
id,
src,
parent,
leaderX,
leaderY,
anchor,
width,
height,
pivot,
preload,
successCb,
errorCb,
x,
y,
z;

 

//in hololens

this.add3DImage = function (...args) {
/* eslint-disable no-unused-vars */
let tracker,
id,
src,
parent,
leaderX,
leaderY,
anchor,
width,
height,
pivot,
preload,
successCb,
errorCb;

```

 

hololens view app version is 922

 

is there another solution? 

 

1 REPLY 1

Hi @BC_10971006 ,

so far I know there are some API's -which are not documented officailly / the term not supported is here the point , which does not means they will not work but are not intented to work in users js's) - so some API's will work only in chrome envirment ,becasue they are only developed as part of the Vuforia Studio UI - means they are used internally in Vuforia Studio UI. I belived that the mentioned API is one of them. So such API's are not implmeted in the device enviroment/ios , android, HL.

So far I know currently we do not have option to create dynamicaly widget, so that we can only change them.

We can create some enties wih add3DObjec  as described in https://www.ptc.com/en/support/article/CS358501

and https://www.ptc.com/en/support/article/CS359260 

but these objects are not really widgets but only 3d entities- I am not sure if we can apply userpick on them

-now tetested - yes they can be identfied by userpick, e.g.

2024-12-23_15-43-44.jpg

 

-the other option is to use tmltext for dynamic creattion but that will work so far I know , only when we start /load the view widget and will be not updated later (at least that was the behavior for   model Target widget when I tried to test it in the past)

 

 

Announcements

Top Tags