Skip to content

Commit

Permalink
Fix throw and torque forces, sprite scale on 1080p
Browse files Browse the repository at this point in the history
  • Loading branch information
DJDavid98 committed Jan 17, 2024
1 parent c6d2d6b commit 02c0eb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/js/beat-saber/NotePile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ export const NotePile: FC<{ dataSource: DataDisplayProps }> = ({ dataSource }) =
const amounts = useMemo(() => ({
wallSize: screenSize.width * 0.012,
blockSize: screenSize.width * 0.015,
baseTorque: 1e5,
baseTorque: screenSize.width * 3.5,
horizontalForceMax: screenSize.width * 0.04,
clearThrowForceY: screenSize.width / 20,
clearThrowForceXMax: 50,
}), [screenSize.width]);
clearThrowForceY: screenSize.height * 0.05,
}), [screenSize.height, screenSize.width]);

const colors: Record<number, string> = useMemo(() => ({
[ColorType.ColorA]: dataSource.mapData?.leftSaberColor ?? DEFAULT_LEFT_SABER_COLOR,
Expand Down Expand Up @@ -102,11 +101,12 @@ export const NotePile: FC<{ dataSource: DataDisplayProps }> = ({ dataSource }) =
group: 1,
};
body.force = {
x: amounts.clearThrowForceXMax * (Math.random() - 0.5),
x: amounts.blockSize * (Math.random() - 0.5),
y: -amounts.clearThrowForceY,
};
body.frictionAir = 0.01;
});
}, [amounts.clearThrowForceXMax, amounts.clearThrowForceY]);
}, [amounts.blockSize, amounts.clearThrowForceY]);

const trigger = dataSource.liveData?.trigger;
const cutDirection = dataSource.liveData?.cutDirection;
Expand Down Expand Up @@ -191,6 +191,7 @@ export const NotePile: FC<{ dataSource: DataDisplayProps }> = ({ dataSource }) =
render.textures = {};
engineRef.current = null;
window.removeEventListener('contextmenu', clearBlocks);
Events.off(engine, 'afterUpdate', cleanupBodies);
};
}, [addBlock, notesPileCanvasRef, screenSize.height, screenSize.width, amounts.wallSize, clearBlocks, cleanupBodies]);

Expand Down
4 changes: 2 additions & 2 deletions src/js/utils/note-pile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export const getNoteSprite = (cutDirection: number): IBodyRenderOptionsSprite |
return undefined;
}
return {
xScale: 0.35,
yScale: 0.35,
xScale: 0.3,
yScale: 0.3,
texture: texture.toString(),
};
};
Expand Down

0 comments on commit 02c0eb4

Please sign in to comment.