How to initialise shapes with specific rotations? #491
magician11
started this conversation in
General
Replies: 2 comments 2 replies
-
First, you shouldn't define components inside another component's function body, that's a react mistake. To set initial rotation, you can use props like so:
Then, in the Tetrahedron component definition:
You can also use shortand for a single axis (eg. https://codesandbox.io/s/affectionate-saha-163p9?file=/src/Merkaba.js:42-263 |
Beta Was this translation helpful? Give feedback.
1 reply
-
This discussion is quite old, but what if I have a given Matrix - rotation? If i call something like mesh.current.setRotationFromMatrix(matrix) in useEffect(), it will flicker on mount? 🤔 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm just learning three.js, and want to use React since I know that quite well.
I'm trying to do something "simple", like this
Which looks like two tetrahedronBufferGeometry components set at specific rotations. I'm struggling to find in any docs how to set the rotation as a parameter on render..
I setup some minimal code on it here
https://codesandbox.io/s/misty-glitter-rh633?file=/src/Merkaba.js
How would I calculate the initial rotation for this setup?
Also any feedback on best practices with react-three-fiber doing this is welcome.
Beta Was this translation helpful? Give feedback.
All reactions