From 7b0dbddc459603118cdd42902e352914bf81cdb5 Mon Sep 17 00:00:00 2001 From: Marius Unsel Date: Tue, 24 Feb 2026 01:26:17 +0100 Subject: [PATCH] make player model changable --- src/components/talkyFace.tsx | 3 ++- src/game/player.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/talkyFace.tsx b/src/components/talkyFace.tsx index aead2ad..3807db8 100644 --- a/src/components/talkyFace.tsx +++ b/src/components/talkyFace.tsx @@ -4,6 +4,7 @@ import * as THREE from 'three'; import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'; import { AppState } from '../store'; import { connect } from 'react-redux'; +import { PLAYER_MODEL_FILENAME } from '../game/player'; interface TalkyFaceProps { @@ -58,7 +59,7 @@ class TalkyFace extends Component { // ROBOT MODEL this.clock = new THREE.Clock() let loader = new GLTFLoader(); - loader.load('assets/models/RobotExpressive.glb', (gltf) => { + loader.load(PLAYER_MODEL_FILENAME, (gltf) => { this.model = gltf.scene; this.animations = gltf.animations; this.mixer = new THREE.AnimationMixer(this.model) diff --git a/src/game/player.ts b/src/game/player.ts index 679e7c8..50bf908 100644 --- a/src/game/player.ts +++ b/src/game/player.ts @@ -13,7 +13,8 @@ import { wonLevel } from '../store/executionState/actions'; // model control from https://github.com/mrdoob/three.js/blob/master/examples/webgl_animation_skinning_morph.html // var states = ['Idle', 'Walking', 'Running', 'Dance', 'Death', 'Sitting', 'Standing']; // var emotes = ['Jump', 'Yes', 'No', 'Wave', 'Punch', 'ThumbsUp']; - +export const PLAYER_MODEL_FILENAME = '/assets/models/RobotExpressive.glb' +//export const PLAYER_MODEL_FILENAME = '/assets/models/robot.glb' export class Player { scene: THREE.Scene; model: THREE.Object3D; @@ -32,7 +33,7 @@ export class Player { this.level = level; this.clock = new THREE.Clock() let loader = new GLTFLoader(); - loader.load('assets/models/RobotExpressive.glb', (gltf) => { + loader.load(PLAYER_MODEL_FILENAME, (gltf) => { this.model = gltf.scene; this.animations = gltf.animations; this.mixer = new THREE.AnimationMixer(this.model)