nytimes / three-story-controls

A three.js camera toolkit for creating interactive 3d stories
Other
249 stars 21 forks source link

Use with OBJLoader #24

Open thomasFoglia opened 2 years ago

thomasFoglia commented 2 years ago

Hi,

It's not working with OBJLoader elements instead of ConeGeometry elements.

Do you have any working snippets ?

Thanks :)

noisyneuron commented 2 years ago

Hi @thomasFoglia

The type of object used would not impact the controls - perhaps a quick test would be to test loading the .obj in a simple scene without the controls, or the three.js editor to ensure the file loads as expected.

Feel free to share some code too.

thomasFoglia commented 2 years ago

Hello,

the OBJ file is valid in the threejs editor.

The OBJ is loaded correctly, I have no error in the console. Without the plugin, the OBJ is visible in the scene.

here is a codepen (it doesn't work because of the dependencies but all the code is there) : https://codepen.io/thomasfoglia/pen/oNEMOBo

my custom code starts on line 145. do you have any ideas ? thanks again !

noisyneuron commented 2 years ago

Hey,

My apologies - I realize the example code can be a little confusing by including the spherical coordinate calculations - that in itself is not important for the controls.

I think the problem in your example is with the calculation of the camera positions.

I would suggest using the camera helper example to be able to freely move around the scene and store the camera positions as appropriate. You can remove lines 37-69 in script.js and replace that with the OBJ loader code, and just add the meshes to the scene.

Hope that helps! I'm in a period of low availability right now, but can update the examples soon to make things less confusing.