Node position and rotation

First of all, happy new year to everyone hahah. I hope everyone had a good time. :smiley:

I was wondering if there was any way to get the position in the scene of the node, as well as its rotation? I’m trying to create a way to click on an object and have the user move towards and face it. I can only really get the position of the mouse click as given in the onNodeTypeClicked function and move the user from there, but with making the user face the object, I haven’t found any solutions.

I also know that we can just have the showroom maker create views for this scenario, but I’m dealing with a huge amount of objects so I’d really like to know if there was a way to get this information.

Thanks, Happy New Year :smiley:

We had a similar need when adding a function to look at lights, light probes and other items in the Shapespark editor and added a seeItem function for this that could be useful for you:

var viewer = WALK.getViewer();
viewer.onNodeTypeClicked(function(node, position, distance) {
  return true;

seeItem will move the camera to be 1 meter from the node bounding sphere, and look towards the node bounding sphere center.


I tried it and it works well, thank you!

Is there anyway to set the distance or something like that?

Side note: To make it work in a live showroom, you have to disable the on click movement by returning true with the onNodeTypeClicked function

1 Like

Unfortunately, seeItem doesn’t take any parameters to modify the distance.