Skip to main content
1-Visitor
August 7, 2019
Question

Rotate Spatial Target (?)

  • August 7, 2019
  • 1 reply
  • 3439 views

Hello,

 

I designed an experience with 218 widgets, and was using a Thingmark. Then I switched to a spatial target. Unfortunately, when you open the experience, you are suddenly viewing it from the left side instead of the front. There isn't an option to rotate the spatial target, or change its position vertically.

 

Since the spatial target defines both the initial perspective and the position relative to ground level, I think the ability to rotate and move in the vertical axis should be possible. I know some other requested features are complex, but I think this would be a fairly quick programming fix for the PTC development team. I'd love to see it in the next version. 🙂

 

Please share kudos, or respond if you would like to see this feature added.

 

Thanks!

Wes

1 reply

18-Opal
August 8, 2019

It's not available in the VS UI for some reason, but the properties on the Spatial Target widget are still there, so you can do what you want with a tiny bit of scripting. You could use something like this:

 

$scope.setRot = function(value) {
 $scope.setWidgetProp("spatialTarget-1","ry",value);
}

angular.element(document).ready(function() { $scope.setRot(90); });

Depending on how your experience is set up, you might need to tweak the code to change the angle or rotate on rx or rz instead of ry. Note that you can modify the "y" property this way as well, if you need to move the spatial target vertically relative to the rest of your scene.

Wes_Tomer1-VisitorAuthor
1-Visitor
September 9, 2019

Hi Clay,

 

Thanks, but no success yet --

 

I went into the JSON files under dist & src and changed the ry value from 0 to 90 for the spatial target. Unfortunately this did nothing. I'm guessing the target tells you where to put the global coordinate system, but the viewing angle is predefined.

 

Did you try this and get different results?

Thanks,

Wes

18-Opal
September 9, 2019

No, I don't think hacking the src files is the way to go. If you use the code I posted above in your Home.js, that will update the rotation of the spatial target at run-time, when the experience starts up.

 

If you want to see it in action live, you can add a slider control to your 2D overlay, set limits to (-180, 180), and set the Value Changed JS to 

setRotation(this.me.value)

Then, in your Home.js, define the function:

$scope.setRotation = function(rot) {
 $scope.setWidgetProp("spatialTarget-1","ry",rot);
}

When you view the experience in the browser Preview, moving the slider will make the spatial target spin around. But when you publish and view it on a device, the spatial target stays fixed and the entire scene will rotate as you move the slider. I've tested it and it works just fine on both iOS and Android.