How to set the camera position

I want to change the location of the camera a little when I click the button.

var cam = hwv.view.getCamera()

I tried to use setCamera() by setting coordinates using setPosition(), but failed.


Is there a file or document that summarizes the functions attached below from the communicator I downloaded?
It’s not easy to find

Please give me some advice

1 Like

Hello @jhbae,

Since you did not provide code on how you are using setPosition, we can’t confirm how it is being used. Worth pointing out is that setPosition requires a Communicator.Point3 object as the argument to the function.

As a quick example, this code snippet below will NOT work and the camera position variable will be undefined:

var cam = hwv.view.getCamera();
var camVar = 0.01;
cam.setPosition(cam.getPosition().x + camVar, cam.getPosition().y + camVar, cam.getPosition().z + camVar);

But this will work when creating a Point3 object:

var cam = hwv.view.getCamera();
var camVar = 0.01;
cam.setPosition(new Communicator.Point3(cam.getPosition().x + camVar, cam.getPosition().y + camVar, cam.getPosition().z + camVar));

WIth respect to documentation on the main navigation bar of the Web Viewer, there is not a centralized location for that. I can notify our docs team about making changes. All that being said, the navigation bar does have mouseover tooltip functionality which provides additional information on the specific icons.



I found the functions I was curious about by referring to the tooltip functionality. Thank you