docs: zwei Planfehler in Aufgabe 1 korrigiert
- controls ist eine Pflichtoption von player.init; der Beispielcode übergab sie nicht, wodurch die App mit einem TypeError startete - der git-add-Befehl hätte den Submodul-Pin still auf den lokalen Branch-Commit umgesetzt Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fbe9b18b5e
commit
2280617d9e
2 files changed
+21
-3
No files matched your search
+14
-1
@@ -4,7 +4,20 @@
|
|||||||
{
|
{
|
||||||
"name": "three-player-controller",
|
"name": "three-player-controller",
|
||||||
"runtimeExecutable": "bash",
|
"runtimeExecutable": "bash",
|
||||||
"runtimeArgs": ["-lc", "cd three-player-controller && npm run dev"],
|
"runtimeArgs": [
|
||||||
|
"-lc",
|
||||||
|
"cd three-player-controller && npm run dev"
|
||||||
|
],
|
||||||
|
"port": 5173,
|
||||||
|
"url": "http://localhost:5173"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "leonida",
|
||||||
|
"runtimeExecutable": "npm",
|
||||||
|
"runtimeArgs": [
|
||||||
|
"run",
|
||||||
|
"dev"
|
||||||
|
],
|
||||||
"port": 5173,
|
"port": 5173,
|
||||||
"url": "http://localhost:5173"
|
"url": "http://localhost:5173"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ Expected: PASS, 4 Tests
|
|||||||
import { ACESFilmicToneMapping, AmbientLight, DirectionalLight, Mesh, MeshStandardMaterial,
|
import { ACESFilmicToneMapping, AmbientLight, DirectionalLight, Mesh, MeshStandardMaterial,
|
||||||
PerspectiveCamera, PlaneGeometry, Scene, Timer, Vector3, WebGLRenderer } from "three";
|
PerspectiveCamera, PlaneGeometry, Scene, Timer, Vector3, WebGLRenderer } from "three";
|
||||||
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
||||||
|
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
|
||||||
import { playerController } from "three-player-controller";
|
import { playerController } from "three-player-controller";
|
||||||
|
|
||||||
const container = document.querySelector("#container");
|
const container = document.querySelector("#container");
|
||||||
@@ -204,6 +205,8 @@ renderer.shadowMap.enabled = true;
|
|||||||
container.appendChild(renderer.domElement);
|
container.appendChild(renderer.domElement);
|
||||||
|
|
||||||
const camera = new PerspectiveCamera(55, container.clientWidth / container.clientHeight, 0.1, 2500);
|
const camera = new PerspectiveCamera(55, container.clientWidth / container.clientHeight, 0.1, 2500);
|
||||||
|
// Pflicht: der Controller liest controls.domElement für Pointer-Lock und Eingaben.
|
||||||
|
const controls = new OrbitControls(camera, renderer.domElement);
|
||||||
scene.add(new AmbientLight(0xffffff, 1.5));
|
scene.add(new AmbientLight(0xffffff, 1.5));
|
||||||
const sun = new DirectionalLight(0xffffff, 2);
|
const sun = new DirectionalLight(0xffffff, 2);
|
||||||
sun.position.set(60, 120, 40);
|
sun.position.set(60, 120, 40);
|
||||||
@@ -218,7 +221,7 @@ scene.add(ground);
|
|||||||
const gltf = await new GLTFLoader().loadAsync("./models/ual.glb");
|
const gltf = await new GLTFLoader().loadAsync("./models/ual.glb");
|
||||||
const player = new playerController();
|
const player = new playerController();
|
||||||
await player.init({
|
await player.init({
|
||||||
scene, camera,
|
scene, camera, controls,
|
||||||
colliders: [{ motion: "static", shape: { kind: "mesh", source: ground } }],
|
colliders: [{ motion: "static", shape: { kind: "mesh", source: ground } }],
|
||||||
initPos: new Vector3(0, 2, 0),
|
initPos: new Vector3(0, 2, 0),
|
||||||
playerModelConfig: {
|
playerModelConfig: {
|
||||||
@@ -251,7 +254,9 @@ Expected: Die Figur steht auf der Fläche, läuft mit WASD und fällt nicht durc
|
|||||||
- [ ] **Step 9: Commit**
|
- [ ] **Step 9: Commit**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git add package.json package-lock.json vite.config.js index.html src tests public/models/ual.glb .gitmodules three-player-controller
|
# three-player-controller NICHT mit `git add` erfassen: das würde den Submodul-Pin still
|
||||||
|
# auf den gerade ausgecheckten Branch-Commit umsetzen. Der Pin wurde in Schritt 1 gesetzt.
|
||||||
|
git add package.json package-lock.json vite.config.js index.html src tests public/models/ual.glb .gitmodules
|
||||||
git commit -m "feat: App-Gerüst mit Spieler auf Testfläche
|
git commit -m "feat: App-Gerüst mit Spieler auf Testfläche
|
||||||
|
|
||||||
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>"
|
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>"
|
||||||
|
|||||||
Reference in new issue
Block a user