Update Templates

This commit is contained in:
2026-10-25 12:37:57 -07:00
parent 1f7ab26404
commit 5974912a25
20 changed files with 64 additions and 155 deletions

6
archery/README.md Normal file
View File

@ -0,0 +1,6 @@
First-person archery template.
- Click the canvas to lock the mouse; Escape to release.
- WASD to move, Shift to run, Space to jump, mouse to look.
- Left mouse button to draw and shoot arrows.
- Keys 1 and 2 adjust the time scale.

View File

@ -82,15 +82,13 @@ class FirstPersonController extends CameraController {
function updateBones() {
// Fetch bone
var bone1 = anim.getBone("mixamorig:LeftForeLnx");
var bone2 = anim.getBone("mixamorig:RightForeLnx");
var bone1 = anim.getBone("mixamorig:LeftForeArm");
var bone2 = anim.getBone("mixamorig:RightForeArm");
// Fetch bone matrix - this is in local bone space for now
var m1 = anim.getBoneMat(bone1);
var m2 = anim.getBoneMat(bone2);
var m1b = anim.getBoneMatBlend(bone1);
var m2b = anim.getBoneMatBlend(bone2);
var a1 = anim.getAbsMat(bone1.parent);
var a2 = anim.getAbsMat(bone2.parent);
var m1 = anim.getBoneMat(anim.skeletonMats, bone1);
var m2 = anim.getBoneMat(anim.skeletonMats, bone2);
var a1 = anim.getWorldMat(anim.skeletonMats, bone1.parent).clone();
var a2 = anim.getWorldMat(anim.skeletonMats, bone2.parent).clone();
// Rotate hand bones to aim with gun
// Some raw math follows..
@ -124,36 +122,6 @@ class FirstPersonController extends CameraController {
m2._31 = ty;
m2._32 = tz;
// Animation blending is in progress, we need to rotate those bones too
if (m1b != null && m2b != null) {
var tx = m1b._30;
var ty = m1b._31;
var tz = m1b._32;
m1b._30 = 0;
m1b._31 = 0;
m1b._32 = 0;
mat.getInverse(a1);
q.fromAxisAngle(mat.right(), angle);
m1b.applyQuat(q);
m1b._30 = tx;
m1b._31 = ty;
m1b._32 = tz;
var tx = m2b._30;
var ty = m2b._31;
var tz = m2b._32;
m2b._30 = 0;
m2b._31 = 0;
m2b._32 = 0;
mat.getInverse(a2);
var v = mat.right();
v.mult(-1);
q.fromAxisAngle(v, -angle / 3.0);
m2b.applyQuat(q);
m2b._30 = tx;
m2b._31 = ty;
m2b._32 = tz;
}
}
function update() {

Binary file not shown.

5
first_person/README.md Normal file
View File

@ -0,0 +1,5 @@
First-person shooter template with physics.
- Click the canvas to lock the mouse; Escape to release.
- WASD to move, Shift to run, Space to jump, mouse to look.
- Left mouse button to fire.

View File

@ -76,16 +76,14 @@ class FirstPersonController extends CameraController {
function updateBones() {
// Fetch bone
var bone1 = anim.getBone("mixamorig:LeftForeLnx");
var bone2 = anim.getBone("mixamorig:RightForeLnx");
var bone1 = anim.getBone("mixamorig:LeftForeArm");
var bone2 = anim.getBone("mixamorig:RightForeArm");
// Fetch bone matrix - this is in local bone space for now
var m1 = anim.getBoneMat(bone1);
var m2 = anim.getBoneMat(bone2);
var m1b = anim.getBoneMatBlend(bone1);
var m2b = anim.getBoneMatBlend(bone2);
var a1 = anim.getAbsMat(bone1.parent);
var a2 = anim.getAbsMat(bone2.parent);
var m1 = anim.getBoneMat(anim.skeletonMats, bone1);
var m2 = anim.getBoneMat(anim.skeletonMats, bone2);
var a1 = anim.getWorldMat(anim.skeletonMats, bone1.parent).clone();
var a2 = anim.getWorldMat(anim.skeletonMats, bone2.parent).clone();
// Rotate hand bones to aim with gun
// Some raw math follows..
@ -119,37 +117,6 @@ class FirstPersonController extends CameraController {
m2._31 = ty;
m2._32 = tz;
// Animation blending is in progress, we need to rotate those bones too
if (m1b != null && m2b != null) {
var tx = m1b._30;
var ty = m1b._31;
var tz = m1b._32;
m1b._30 = 0;
m1b._31 = 0;
m1b._32 = 0;
mat.getInverse(a1);
q.fromAxisAngle(mat.right(), -angle);
m1b.applyQuat(q);
m1b._30 = tx;
m1b._31 = ty;
m1b._32 = tz;
var tx = m2b._30;
var ty = m2b._31;
var tz = m2b._32;
m2b._30 = 0;
m2b._31 = 0;
m2b._32 = 0;
mat.getInverse(a2);
var v = mat.right();
v.mult(-1);
q.fromAxisAngle(v, -1.6);
// q.fromAxisAngle(v, angle);
m2b.applyQuat(q);
m2b._30 = tx;
m2b._31 = ty;
m2b._32 = tz;
}
}
function preUpdate() {

Binary file not shown.

5
platformer/README.md Normal file
View File

@ -0,0 +1,5 @@
Third-person platformer template.
- Click the canvas to lock the mouse; Escape to release.
- WASD to move, Shift to run, Space to jump, mouse to orbit the camera.
- Collect the gems.

Binary file not shown.

4
race_track/README.md Normal file
View File

@ -0,0 +1,4 @@
Vehicle driving template with a lap timer.
- WASD / arrow keys to drive the car.
- Drive through the checkpoints to time your lap.

Binary file not shown.

5
third_person/README.md Normal file
View File

@ -0,0 +1,5 @@
Third-person shooter template.
- Click the canvas to lock the mouse; Escape to release.
- WASD to move, Shift to run, Space to jump, mouse to orbit the camera.
- Left mouse button to fire.

View File

@ -75,16 +75,14 @@ class ThirdPersonController extends CameraController {
function updateBones() {
// Fetch bone
var bone1 = anim.getBone("mixamorig:LeftForeLnx");
var bone2 = anim.getBone("mixamorig:RightForeLnx");
var bone1 = anim.getBone("mixamorig:LeftForeArm");
var bone2 = anim.getBone("mixamorig:RightForeArm");
// Fetch bone matrix - this is in local bone space for now
var m1 = anim.getBoneMat(bone1);
var m2 = anim.getBoneMat(bone2);
var m1b = anim.getBoneMatBlend(bone1);
var m2b = anim.getBoneMatBlend(bone2);
var a1 = anim.getAbsMat(bone1.parent);
var a2 = anim.getAbsMat(bone2.parent);
var m1 = anim.getBoneMat(anim.skeletonMats, bone1);
var m2 = anim.getBoneMat(anim.skeletonMats, bone2);
var a1 = anim.getWorldMat(anim.skeletonMats, bone1.parent).clone();
var a2 = anim.getWorldMat(anim.skeletonMats, bone2.parent).clone();
// Rotate hand bones to aim with gun
// Some raw math follows..
@ -116,36 +114,6 @@ class ThirdPersonController extends CameraController {
m2._31 = ty;
m2._32 = tz;
// Animation blending is in progress, we need to rotate those bones too
if (m1b != null && m2b != null) {
var tx = m1b._30;
var ty = m1b._31;
var tz = m1b._32;
m1b._30 = 0;
m1b._31 = 0;
m1b._32 = 0;
mat.getInverse(a1);
q.fromAxisAngle(mat.right(), -angle);
m1b.applyQuat(q);
m1b._30 = tx;
m1b._31 = ty;
m1b._32 = tz;
var tx = m2b._30;
var ty = m2b._31;
var tz = m2b._32;
m2b._30 = 0;
m2b._31 = 0;
m2b._32 = 0;
mat.getInverse(a2);
var v = mat.right();
v.mult(-1);
q.fromAxisAngle(v, angle);
m2b.applyQuat(q);
m2b._30 = tx;
m2b._31 = ty;
m2b._32 = tz;
}
}
function preUpdate() {

Binary file not shown.

View File

@ -75,16 +75,14 @@ class ThirdPersonController extends CameraController {
function updateBones() {
// Fetch bone
var bone1 = anim.getBone("mixamorig:LeftForeLnx");
var bone2 = anim.getBone("mixamorig:RightForeLnx");
var bone1 = anim.getBone("mixamorig:LeftForeArm");
var bone2 = anim.getBone("mixamorig:RightForeArm");
// Fetch bone matrix - this is in local bone space for now
var m1 = anim.getBoneMat(bone1);
var m2 = anim.getBoneMat(bone2);
var m1b = anim.getBoneMatBlend(bone1);
var m2b = anim.getBoneMatBlend(bone2);
var a1 = anim.getAbsMat(bone1.parent);
var a2 = anim.getAbsMat(bone2.parent);
var m1 = anim.getBoneMat(anim.skeletonMats, bone1);
var m2 = anim.getBoneMat(anim.skeletonMats, bone2);
var a1 = anim.getWorldMat(anim.skeletonMats, bone1.parent).clone();
var a2 = anim.getWorldMat(anim.skeletonMats, bone2.parent).clone();
// Rotate hand bones to aim with gun
// Some raw math follows..
@ -116,36 +114,6 @@ class ThirdPersonController extends CameraController {
m2._31 = ty;
m2._32 = tz;
// Animation blending is in progress, we need to rotate those bones too
if (m1b != null && m2b != null) {
var tx = m1b._30;
var ty = m1b._31;
var tz = m1b._32;
m1b._30 = 0;
m1b._31 = 0;
m1b._32 = 0;
mat.getInverse(a1);
q.fromAxisAngle(mat.right(), -angle);
m1b.applyQuat(q);
m1b._30 = tx;
m1b._31 = ty;
m1b._32 = tz;
var tx = m2b._30;
var ty = m2b._31;
var tz = m2b._32;
m2b._30 = 0;
m2b._31 = 0;
m2b._32 = 0;
mat.getInverse(a2);
var v = mat.right();
v.mult(-1);
q.fromAxisAngle(v, angle);
m2b.applyQuat(q);
m2b._30 = tx;
m2b._31 = ty;
m2b._32 = tz;
}
}
function preUpdate() {

View File

@ -1,11 +1,16 @@
{
"rp_bloom": true,
"rp_chromatic_aberration": true,
"rp_dynres": false,
"rp_gi": true,
"rp_fsr1": false,
"rp_fsr1_sharpness": 0.25,
"rp_gi": false,
"rp_motionblur": false,
"rp_shadowmap_cascade": 2048,
"rp_shadowmap_cube": 512,
"rp_ssgi": true,
"rp_ss_refraction": true,
"rp_ssao": true,
"rp_ssgi": false,
"rp_ssr": true,
"rp_supersample": 1.0,
"window_h": 720,

4
top_down/README.md Normal file
View File

@ -0,0 +1,4 @@
Top-down shooter template.
- WASD to move, mouse to aim.
- Left mouse button to fire.

Binary file not shown.

4
twin_stick/README.md Normal file
View File

@ -0,0 +1,4 @@
Twin-stick shooter template.
- WASD to move, mouse (or gamepad right stick) to aim.
- Left mouse button to fire.

Binary file not shown.