fix: rotation clampiness

This commit is contained in:
cha0s 2021-02-04 00:04:05 -06:00
parent e2fe91dffd
commit 215e73d3f1

View File

@ -4,10 +4,11 @@ import {Packet} from '@latus/socket';
export default () => class TraitUpdateVisiblePacket extends Packet {
static pack(data) {
const rotation = ((data.rotation % TWO_PI) + TWO_PI) % TWO_PI;
return {
isVisible: data.isVisible,
opacity: Math.floor(data.opacity * 255),
rotation: Math.floor(((data.rotation % TWO_PI) / TWO_PI) * 65536),
rotation: Math.floor((rotation / TWO_PI) * 65536),
};
}