What is the best way to keep track of the location of the view. For example if the user is in walk mode and I want their location to be a trigger for some other event, what is the best way to get the x,y,z location.
I’m not exactly sure what the question is. To get the camera location check for Sketchup.active_model.active_view.camera.eye.
To trigger something by moving the camera I think you need to set up a loop that frequently check if the camera is within the area (or actually volume) that you are interesting in. I don’t think there is a way to do it with observers.
I have tried creating an observer object for the ‘view’ which seems to have only one method that tells when the view has changed. I used this method to create a new camera object at the current view. The camera object can then give me its location with view.camera.eye. I can then use that value to figure out where the viewer is at in the model. I am wondering if this is the best way or only way to go about finding the location of the viewer/user in model.
Thanks for your help.
It is the best way and the way I would also do it via an observer.
You can also just get it from within some other event, by calling:
pt = Sketchup.active_model.active_view.camera.eye
That is what I was looking for. Thank you.