-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ref.current.position didn't update #378
Comments
hi,
and then try to apply to the camera |
this help me fix this issue, thank you very much. however I still have some queries point on this issue,
same code as above works when I'm using
|
I ended up subscribing and setting the const [bodyRef, physicsApi] = useCompoundBody(/* ... */)
useEffect(() => {
return physicsApi.position.subscribe((v) => {
bodyRef.current.position.fromArray(v);
});
}, [physicsApi, bodyRef]);
useEffect(() => {
return physicsApi.quaternion.subscribe((v) => {
bodyRef.current.quaternion.fromArray(v);
});
}, [physicsApi, bodyRef]); Then I could do stuff like this successfully: otherObject.position.copy(bodyRef.current.position);
otherObject.quaternion.copy(bodyRef.current.quaternion); 🤔 Does using existing |
👋 Hi there, I was learning react-three-fiber with https://youtu.be/ZnXKmODEFHA?t=961
When I'm try to use
camera.position.copy(ref.current.position)
to move with the sphere I just created, I foundref.current.position
doesn't update.Here's my code:
and my dependency:
The text was updated successfully, but these errors were encountered: