react-three-renderer icon indicating copy to clipboard operation
react-three-renderer copied to clipboard

OrbitControls

Open agrande opened this issue 9 years ago • 7 comments

I'm trying to implement an equivalent of OrbitControls, but so far I don't see a way to do it that is well integrated with React. Any thoughts given to this yet? Do you see this as part of react-three-renderer or per-application custom code in components?

Kudos for the hard work on this lib! This looks very promising!

agrande avatar Jan 24 '16 16:01 agrande

I recommend looking at the source for webgl camera example, and the trackball modified trackball controls code for something very similar :)

toxicFork avatar Jan 26 '16 18:01 toxicFork

The second part: I see this as a plugin/module opportunity, or per application custom code

toxicFork avatar Jan 26 '16 18:01 toxicFork

Thanks for the answer. I didn't notice that the camera example had trackball controls.

agrande avatar Feb 03 '16 21:02 agrande

is there any way how to use orbit-three-controls together with react-three-renderer?

martunta avatar Oct 09 '16 18:10 martunta

I was able to get OrbitControls working in react-three-renderer with almost no modifications. See this diff to OrbitControls.js: https://github.com/austinsims/tablesim-r3r/commit/499e73d8facca798ea5938783095e4c3e1be2fb3#diff-f03a52bf6b428186393292c8c2c41d98

And this corresponding diff to a stripped down Simple.js (from react-three-renderer-example repository): https://github.com/austinsims/tablesim-r3r/commit/499e73d8facca798ea5938783095e4c3e1be2fb3#diff-1f7b0552e72334a51917a6ba613bbc2b

austinsims avatar Oct 11 '16 01:10 austinsims

should work without modifying orbitControls.js, if using orbit-three-controls. Thought I can't really get it to work. Getting some strange warnings about 'unknown prop' after adding ref to React3 tag. Everything is rendered, but no orbitcontrols.

I don't want to modify orbitcontrols library itself. But those unknown prop warnings indicate that something else might be wrong though.

martunta avatar Oct 12 '16 18:10 martunta

ok, I went simpler, and it works. See this gist for super simple implementation.

martunta avatar Oct 12 '16 18:10 martunta