-
Notifications
You must be signed in to change notification settings - Fork 0
/
RedSword.js
34 lines (29 loc) · 1.08 KB
/
RedSword.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import * as THREE from './libs/three.module.js'
import { MTLLoader } from './libs/MTLLoader.js'
import { OBJLoader } from './libs/OBJLoader.js'
class RedSword extends THREE.Object3D{
constructor(){
super();
var that = this;
var materiaLoader = new MTLLoader();
var objectLoader = new OBJLoader();
materiaLoader.load('models/attack_sword_model/attack_sword_red.mtl',
function(materials){
objectLoader.setMaterials(materials);
objectLoader.load('models/attack_sword_model/attack_sword_red.obj',
function(object){
var modelo = object;
var modelo = object
modelo.scale.set(1, 1, 1)
that.add(modelo);
},null,null);
});
var geometry = new THREE.BoxGeometry(3, 10, 3);
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
this.cube = new THREE.Mesh( geometry, material );
this.cube.name="cubo"
this.cube.visible=false
this.add(this.cube)
}
}
export { RedSword };