logs in console, caching in getAgentProps, console createAgent independent of GUI
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
//////////////TESTING /////////////////
|
||||
this.threeClock = new THREE.Clock()
|
||||
const loader = new GLTFLoader().setPath( '/app/assets/3dModels/' );
|
||||
loader.load( 'mechdrone/scene.gltf', async function ( gltf ) {
|
||||
|
||||
const model = gltf.scene;
|
||||
|
||||
// wait until the model can be added to the scene without blocking due to shader compilation
|
||||
|
||||
await this.renderer.compileAsync( model, this.camera, this.scene );
|
||||
model.scale.set(5,5,5)
|
||||
this.scene.add( model )
|
||||
model.traverse(obj => {
|
||||
console.log(
|
||||
obj.type,
|
||||
obj.name || '(no name)',
|
||||
obj.isBone ? '[BONE]' : ''
|
||||
)
|
||||
|
||||
|
||||
if (obj.isMesh && obj.material && obj.material.color) {
|
||||
const c = obj.material.color.clone()
|
||||
const boost = 0.1 // réglage global
|
||||
obj.material.emissive = c
|
||||
obj.material.emissiveIntensity = boost
|
||||
}
|
||||
})
|
||||
this.leftArm = model.getObjectByName('ArmL1_01')
|
||||
|
||||
if (gltf.animations && gltf.animations.length > 0) {
|
||||
this.mixer = new THREE.AnimationMixer(gltf.scene)
|
||||
// On joue la première animation
|
||||
const action = this.mixer.clipAction(gltf.animations[0])
|
||||
action.play()
|
||||
}
|
||||
}.bind(this) )
|
||||
|
||||
// In Render:
|
||||
const delta = this.threeClock.getDelta()
|
||||
if(this.mixer) this.mixer.update(delta)
|
||||
Reference in New Issue
Block a user