First, run the development server:
turbo dev
# or one of these:
npm run dev
yarn dev
pnpm dev
bun devOpen http://localhost:3000 with your browser to see the result.
# cwebp e.g. https://developers.google.com/speed/webp/docs/precompiled
# must be version 1.5.0 libsharpyuv: 0.4.1
# ImageMagick
brew install imagemagick# fix `npm install` of npm module `canvas`
# https://github.com/Automattic/node-canvas/issues/1825#issuecomment-1090125736
brew install pkg-config cairo pango libpng jpeg giflib librsvgSymbol PNGs should be unzipped in /media
Geomorph PNGs (background in hull symbols) should be unzipped in /media
Related resources (less/more resolution)
Then you can run the various scripts (as needed) found inside scripts/get-pngs.js.
- Our SVG symbols currently do not support parent transforms
- e.g. on "symbols" folder
- npm module
canvas(a.k.a. node-canvas) loadImage does not handle bothtransformandtransform-box.
<path d="M 1088 192 L 1088 128 L 1040 192 L 1088 192 Z" style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0); transform-box: fill-box; transform-origin: 50% 50%;" transform="matrix(-1, 0, 0, -1, 0, 0)">
<bx:title>_debug-path-transform</bx:title>
</path>In BoxySVG we can Object > transform > Reduce Transform.
-
Similar for transform on
<image>e.g. scale. -
Avoid deep properties
state.foo.barinsideuseStateRefe.g. because they won't be reloaded iffoostays same name butbarchanges tobaz. -
Choppy framerate can occur when OS hints "Low Power" (e.g. OSX). Can see 60fps in @react-three/drei Stats yet seems choppier. Does not seem to get fixed when stop "Low Power" without hard refresh. Possible Chrome restart too.
These are removed in production via next.config output export.
curl --silent localhost:3000/api/connect/myFunUid/dev-events
curl --silent -XPOST localhost:3000/api/send-dev-event
curl --silent -XPOST localhost:3000/api/close-dev-events -d'{ "clientUid": 1234 }'c=-1; while c+=1; do
spawn npc:"rob_${c}" at:$( click 1 ) granted:.
done
# much faster version:
seq 100 |
map '(_, { w }) => w.crowd.navMeshQuery.findRandomPoint().randomPoint' &>>pts
w npc.spawnMany "{ points: $( pts ) }"
# commands work while paused via prefix `ptags=always;`
ptags=always events
# reset or save control state i.e. current view
w view.controls.reset
w view.controls.saveState
# this command does not exit until the World is enabled
test $( w disabled ) &&
events '({ key }) => key === "enabled"' | take 1
# modify npc rob's skin
w n.rob.skin | assign '{ "body-overlay-front": { prefix: "plus-icon" }}'
w n.rob.applySkin
# reset npc rob's skin
w n.rob.resetSkin
# pass from Vector3 to Vect for an internal function which only supports the latter
click -2 | w n.rob.getLookAngle -
w view.controls | assign '{minDistance:1}'
w n.rob.position | w floor.setTorchTarget -
foo() { jsArg "${@}"; }
foo bar:[1,4,9] baz:baz qux:42
foo() { echo $( jsArg "${@}" ); }
foo bar:[1,4,9] baz:baz qux:42
while { false; test ${?}; }; do echo foo; done
while { true; ! test ${?}; }; do echo foo; done
# more stuff
ptags=always; click 5 meta.nav | while take 1; do
points/at'(-1)' >&2
done &>> points
c=0; while c+=1; do
test $( expr "$c >= 5" ) && c=0
move npc:rob arriveAnim:none to:"$( points/$c )"
done
# playing with loops
spawn npc:rob at:$( click 1 )
spawn npc:kate at:$( click 1 ) as:medic-0
w e.grantAccess . rob kate
tour npc:rob to:"$( click 2 )" &
tour npc:kate to:"$( click 2 )" &
spawn npc:kate at:$( click 1 ) as:soldier-0,,medic-0,
spawn npc:kate at:$( click 1 ) as:soldier-0,,,suit-0
spawn npc:kate at:$( click 1 ) as:suit-0,,,soldier-0
click 5 &>> points
# skips to next point if stopped
while true; do
tour npc:kate to:"$( points )"
done &
call Math.random
expr 'Math.random() * 2 * Math.PIFollow instructions here:
https://github.com/rob-myers/recast-navigation-js/blob/main/DEVELOPMENT.md
brew install cmake
# at repo root
git checkout feat/expose-all-mesh-anim
# yarn build does not work, but we can:
yarn build:packages2
# might have to manually delete packages/recast-navigation-wasm/{build,dist}We can also patch package1/node_modules/package2
This permits us to patch three-stdlib inside @react-three/drei.
npx patch-package @react-three/drei/three-stdlib- https://github.com/Genymobile/scrcpy/blob/master/doc/macos.md
- https://github.com/Genymobile/scrcpy?tab=readme-ov-file
export PATH="$PATH:~/Downloads/scrcpy-macos-aarch64-v3.3.1"
# plug phone into usb and permit usb debug (via settings > developer options)
scrcpy --video-codec=h265 --max-size=1920 --max-fps=60 --no-audio --keyboard=uhid
# this command works with Quicktime Player
# https://github.com/Genymobile/scrcpy/issues/4068#issuecomment-1581233072
scrcpy --video-codec=h265 --max-size=1920 --max-fps=60 --no-audio --keyboard=uhid --video-codec=h264 --video-encoder='OMX.google.h264.encoder' --record=file.mp4
# π no need for record because we'll use OBS
scrcpy --video-codec=h265 --max-size=1920 --max-fps=120 --no-audio --keyboard=uhid --video-codec=h264 --video-encoder='OMX.google.h264.encoder' --disable-screensaverCurrently tsconfig.json paths only works in webpack (yarn dev-webpack) not turbopack (yarn dev),
see vercel/next.js#72346.
This means that in dev we'll uncomment tsconfig paths and use webpack,
but after publishing we should re-comment these paths and use turbopack.
- Manually bump versions
- search for current patch e.g.
0.39.7and replace with next e.g.0.39.8 - do not include yarn.lock, files should be:
packages/recast-navigation{,-core,-generators,-playcanvas,-three,-wasm}
-
Run
yarn -
Commit and push e.g. to branch
feat/expose-off-mesh-anim -
Run
yarn publish- π may have to wait a bit for registry to update
- Bump package.json versions, e.g.
"@recast-navigation/core": "npm:@rob-myers/recast-navigation__core@0.39.2",
"@recast-navigation/generators": "npm:@rob-myers/recast-navigation__generators@0.39.2",
"@recast-navigation/three": "npm:@rob-myers/recast-navigation__three@0.39.2",
"@recast-navigation/wasm": "npm:@rob-myers/recast-navigation__wasm@0.39.2",- Run
npm install
yarn dev
# get local ip address for mobile development
ipconfig getifaddr en0
# navigate to http://${ipAddress}:3000NPM module canvas was compiled against a different Node.js version
Following this answer we can start VSCode in a terminal whose node version matches the repo's node version.
cd $REPO_ROOT
nvm use
code .We don't support transforms applied to <g>s, for example in skin SVGs.
π maybe we should...
In BoxySVG, you can avoid introducing transforms on <g>s by
- selecting all of its children (rather than the Group)
- e.g. Geometry > change Y.
In BoxySVG, if your <g> already has a transform you can use this trick:
- drag contents outside Group
- remove transform from Group (e.g. via elements panel E)
- drag contents back into Group
# if necessary
brew install ffmpeg
# Convert mov to mp4
cd ~/Desktop
ffmpeg -i ~/Desktop/html-3d-example.mov -qscale 0 html-3d-example.mp4
ffmpeg -i ~/Desktop/html-3d-example.mov -filter_complex "[0:v] fps=10" -b:v 0 -crf 25 html-3d-example.mp4
ffmpeg -i ~/Desktop/html-3d-example.mov -filter_complex "[0:v] fps=30" -b:v 0 -crf 25 html-3d-example.mp4
ffmpeg -i ~/Desktop/html-3d-example.mov -filter_complex "[0:v] fps=60" -b:v 0 -crf 25 html-3d-example.mp4We originally calculated the following in order to simulate slow-down inside offMeshConnections. However we decided upon a simpler approach i.e. add time scaling factor
tScaletodtCrowdAnimationand tween it.
- Suppose move in 1D with:
- init/final position
x(0) := 0,x(t_1) := x_1wheret_1unknown. - init/final velocity
v(0) := u_0,v(t_1) := u_1.
- init/final position
- Suppose we constantly decelerate i.e.
dv/dt = a β€ 0from speedu_0tou_1at timet_1
It follows that:
v(t) = u_0 + a . tfor allt β₯ 0x(t) = u_0 . t + a/2 . t^2for allt β₯ 0.v(t_1) = u_1hencet_1 = (u_0 - u_1) / |a|x(t_1) = x_1hencex_1 = ((u_0 - u_1) / |a|). ( u_0 - (u_0 - u_1) / 2 )i.e.x_1 = (1 / 2|a|) . (u_0 - u_1). (u_0 + u_1)
Sanity check: if u_0 = u_1 then t_1 = x_1 = 0 i.e. immediate.
Sanity check: if u_1 = 0 then x_1 = 0.5 . 1/|a| . u_0^2
Then we know:
- the deceleration
|a| = 0.5 . (1 / x_1) . (u_0 - u_1) . (u_0 + u_1). - the time
t_1 = (u_0 - u_1) / |a| = 2 * x_1 * (1 / (u_0 + u_1))
We'll try to re-map publicly available Minecraft Skins.