diff --git a/lib/pages/creature-page.tsx b/lib/pages/creature-page.tsx index afe8cdf..9a67352 100644 --- a/lib/pages/creature-page.tsx +++ b/lib/pages/creature-page.tsx @@ -64,17 +64,21 @@ type CreatureSymbolProps = { attachIndex?: number; }; +function rad2deg(radians: number): number { + return (radians * 180) / Math.PI; +} + const CreatureSymbol: React.FC = (props) => { const ctx = useContext(CreatureContext); const { data, attachTo, attachIndex } = props; const ourSymbol = ( <> - {props.children && ( {props.children} )} + ); @@ -91,12 +95,21 @@ const CreatureSymbol: React.FC = (props) => { const parentAp = getAttachmentPoint(parent, attachTo, attachIndex); const ourAp = getAttachmentPoint(data, "tail"); const dist = subtractPoints(parentAp.point, ourAp.point); + const normX = parentAp.normal.x; + const theta = rad2deg(Math.PI / 2 - Math.acos(Math.abs(normX))); + let xFlip = 1; + + if (normX < 0) { + xFlip = -1; + } return ( {ourSymbol} @@ -115,7 +128,7 @@ const Eye = createCreatureSymbol("eye"); const Hand = createCreatureSymbol("hand"); -const Cup = createCreatureSymbol("cup"); +const Arm = createCreatureSymbol("arm"); export const CreaturePage: React.FC<{}> = () => { return ( @@ -125,8 +138,10 @@ export const CreaturePage: React.FC<{}> = () => { - + + +