This is where I keep notes for things I keep revisiting throughout my work. Entries are sorted alphabetically.
When setting up an email account, make sure to enable SPF, DKIM, and DMARC to properly authenticate messages and help prevent outgoing email from being marked as spam. Use https://www.dmarctester.com to test this.
When sending email through a third party SMTP service for a Google Workspace account, “Allow per-user outbound gateways” must be enabled in the admin panel to avoid email being silently rejected.
Commit without a message
git add -A && git commit --allow-empty-message -m '' && git push
Git submodules are a nice way of setting up project dependencies.
You can add a dependency into a repo by running:
git submodule add https://github.com/marcospgp/steamworksnt.git <target-folder>
To update dependencies or download them after a fresh
git clone, use:
git submodule update --init --recursive --merge --remote
Unity game dev
As of 2023-10-06, and since a new Unity extension for VSCode has been released, there is no official way to support adding Roslyn analyzers for C# code (perhaps other than reverting to using Omnisharp).
I may revisit this later, but at this point it might be wiser to wait for the VSCode extension to become more mature.
- “bake into pose” root transform changes that shouldn’t be applied to the gameobject on each animation.
Downloading animations “without skin” prevents wasting memory with unnecessary models. However, the avatar generated by Unity for these won’t work properly. That can be fixed by downloading the default Mixamo character (Y Bot) in T-pose and generating an avatar from it, which can then be used with “without skin” Mixamo animations.
Movement without foot sliding
Goal: set up player movement that is script controlled (as opposed to root motion based, for better responsiveness), but sync up animations to minimize discrepancies such as foot sliding.
- Set up blend tree
- 2D simple directional (no idle animation)
- 8 directional animations (minimize velocity difference when blending - for example, blending a forward with a sideways animation can result in diagonal movement that is slower than either of the other animations individually. Blending animation root motion is poorly documented.)
- Adjust animation speeds so that each has a resulting velocity of 1m/s
- Compute positions -> Velocity XZ
- Divide animation speed by norm of velocity
- Reset animation positions to unit circle coordinates
- Set blend tree animation direction through X and Y parameters connected to user input
- Adjust blend tree speed by setting a parameter to be equal to the player’s speed
- Transition to/from idle animation
- Idle animation cannot be in blend tree as the blend tree’s speed will be modified
- Blending between idle and movement animations is unreliable anyway in terms of resulting velocity (unpredictable, non-linear)
This is what the resulting blend tree looks like:
It may be possible to still blend between movement and other animations by nesting blend trees, although copy pasting a blend tree you previously created requires a simple workaround.
- Disable saving
.blendfiles directly inside the Unity project’s “Assets” folder
- There doesn’t seem to be a way to store textures in
.blendfile, so keep them in “Assets” folder and use them in both Blender and Unity
Fix color banding by checking “enable dithering” in the camera inspector.
- Only the last LOD matters
- Impostors > LOD meshes
- Advancements like Nanite can change 3D lore fast
Frame rate independent lerp
Use a frame rate independent form of linear interpolation instead of the default
Ready to use code should be available in the Unity utilities repo.