How to set a Constraint ? #90
-
I am sorry but i don't understand how to set a constraint, for example Hinge. I don't really understand typescript yet, and wrote the code below but i am stuck in using the hook . https://gist.github.com/Franckapik/0540c44ca05e07ae5573178ff5eb6793 Is that correct syntax ? How is it possible to add constraint to the world next ? have you got example ? Thank you really much !! F. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Ok i've got it ! Just to understand, the examples are not linked in the docs because they are in development ? |
Beta Was this translation helpful? Give feedback.
-
And i just realized that "spring" could mean another thing than the season according to this usefull image : :) |
Beta Was this translation helpful? Give feedback.
-
Hey @Franckapik, it looks like you got it figured out, but you had the useHingeConstraint(bodyA, bodyB, options, deps) These are described in the readme under the API section. It would probably be a good idea to mention the examples directory in the readme too. function useHingeConstraint(
bodyA: React.MutableRefObject<THREE.Object3D>,
bodyB: React.MutableRefObject<THREE.Object3D>,
optns: HingeConstraintOpts,
deps: any[] = [],
): ConstraintApi |
Beta Was this translation helpful? Give feedback.
-
Thank you @codynova for your help ! Thank you again ! https://codesandbox.io/s/github/Franckapik/NandY/tree/master/views?file=/src/3d/jsx/Essai.js I am applying impulse on rear wheel, and try to rotate front wheel to turn the car but it seems that i have an issue on this... |
Beta Was this translation helpful? Give feedback.
Hey @Franckapik, it looks like you got it figured out, but you had the
useHingeConstraint
function signature wrong. It should be:These are described in the readme under the API section. It would probably be a good idea to mention the examples directory in the readme too.