threebox
threebox copied to clipboard
obj.setRotation has no effect when argument is 0
Describe the bug using obj.setRotation with a value of 0 (to reset rotation) has no effect.
I believe it is caused by this line: https://github.com/jscastro76/threebox/blob/f01ed8f9dd7059d27ad83c73adab2dbcdc817bc5/src/objects/objects.js#L128
Where 0 is falsy, causing the right-hand side of the expression to be used instead. This causes the object to just retain its rotation. This is somewhat noticeable when using alt to rotate objects too, where the object will 'skip' over 0 causing a slightly less smooth rotation around the default rotation.
I'm not sure if this is how it is supposed to work, but this could probably be solved easily using ?? (nullish-coalescing) operators instead of ||.
Not sure if this needs a reproducible example / codesandbox. Can provide if necessary.
Version [2.2.7]