-
Notifications
You must be signed in to change notification settings - Fork 156
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
Cannot set quaternion
in argsFn of useBox
(and other useBody hooks)
#389
Comments
quaternion
in useBox
(and other useBody hooks) argsFnquaternion
in argsFn of useBox
(and other useBody hooks)
Thanks for working on this @Soham1803 The body props type has both a We should update |
Won't these lead to conflicts if we have two different props handling the same property of the body? |
We'd just need to prefer one if both are provided, we can document the behaviour. |
Ok I got it. I hope this #437 solves it. I requested a pull for a new branch. I noticed I had unnecessary changes in my yarn.lock file pushed in the previous branch. |
Thanks @Soham1803 🙂 will get this released shortly |
Well, thanks to you too @isaac-mason for your guidance. 😇 |
The fix has been released, closing this issue |
When using one of the hooks like
useBox
oruseTrimesh
, one can setrotation
inside the object returned fromargsFn
, but aquaternion
property is ignored (the body's rotation will always be reset to zero when dependencies of theuseX
hook change).A brief check in the code suggests that the problem is in
use-cannon/packages/cannon-worker-api/src/props-to-body.js
Line 61 in 90dfc12
propsToBody
in the worker code only extractsrotation
from props, but notquaternion
.The workaround right now is simply to use
rotation
rather thanquaternion
, or convert quaternions to Euler angles when saving the rotation externally to later restore it. But as the API allows working only with quaternions, I think it would be appropriate to also allow users to set the body's quaternion in theargsFn
of the hooks.The text was updated successfully, but these errors were encountered: