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 { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
||||||
import { AppState } from '../store';
|
import { AppState } from '../store';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import { PLAYER_MODEL_FILENAME } from '../game/player';
|
||||||
|
|
||||||
|
|
||||||
interface TalkyFaceProps {
|
interface TalkyFaceProps {
|
||||||
@ -58,7 +59,7 @@ class TalkyFace extends Component<TalkyFaceProps> {
|
|||||||
// ROBOT MODEL
|
// ROBOT MODEL
|
||||||
this.clock = new THREE.Clock()
|
this.clock = new THREE.Clock()
|
||||||
let loader = new GLTFLoader();
|
let loader = new GLTFLoader();
|
||||||
loader.load('assets/models/RobotExpressive.glb', (gltf) => {
|
loader.load(PLAYER_MODEL_FILENAME, (gltf) => {
|
||||||
this.model = gltf.scene;
|
this.model = gltf.scene;
|
||||||
this.animations = gltf.animations;
|
this.animations = gltf.animations;
|
||||||
this.mixer = new THREE.AnimationMixer(this.model)
|
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
|
// 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 states = ['Idle', 'Walking', 'Running', 'Dance', 'Death', 'Sitting', 'Standing'];
|
||||||
// var emotes = ['Jump', 'Yes', 'No', 'Wave', 'Punch', 'ThumbsUp'];
|
// 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 {
|
export class Player {
|
||||||
scene: THREE.Scene;
|
scene: THREE.Scene;
|
||||||
model: THREE.Object3D;
|
model: THREE.Object3D;
|
||||||
@ -32,7 +33,7 @@ export class Player {
|
|||||||
this.level = level;
|
this.level = level;
|
||||||
this.clock = new THREE.Clock()
|
this.clock = new THREE.Clock()
|
||||||
let loader = new GLTFLoader();
|
let loader = new GLTFLoader();
|
||||||
loader.load('assets/models/RobotExpressive.glb', (gltf) => {
|
loader.load(PLAYER_MODEL_FILENAME, (gltf) => {
|
||||||
this.model = gltf.scene;
|
this.model = gltf.scene;
|
||||||
this.animations = gltf.animations;
|
this.animations = gltf.animations;
|
||||||
this.mixer = new THREE.AnimationMixer(this.model)
|
this.mixer = new THREE.AnimationMixer(this.model)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user