make player model changable
This commit is contained in:
parent
efd4369f41
commit
7b0dbddc45
@ -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<TalkyFaceProps> {
|
||||
// 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)
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user