API to expose model’s position to the webpage

Could someone please point me to an example of using an event and an API callback function to send the model’s position (angles of the 3 axis?) to the page when the user stops/pauses rotating the model?

Something like this (a fantasy)

Object.addEventListener(“onPause”, function() {

I am trying to build interaction into a webpage, and have user input come from manipulating the model with the mouse or touch.

Thank you!

I know now that the event that fires when the user stops rotating the model is ‘camerastop’. Half of my fantasy fulfilled! But I can’t figure out what parameters are sent with that event that would allow me to determine the position/angle(s) of the model that the user has brought it to. Any hints? Thanks.

I figured out the second answer to my original query: the position of the model can be gleaned by querying getCameraLookAt(). My complete working solution is at https://russlang.as.cornell.edu/3dmodels/index-3d-c.htm

I don’t know why that page does not work on mobiles. If a kind soul can take a look and immediately spot my blunder, I would be most grateful, but for the purposes of the original posting, it can be closed, I think.

Seems it must be hitting a limit on memory on mobile due to the number of textures in the model, you would need to make a separate model using texture atlas to make for minimum number of textures.

1 Like