[英]object orientated javascript
I've got this object player1 and i can't get the scene.add(Obj);
我有这个对象player1,但我无法获得
scene.add(Obj);
line to work as it comes up with an error saying Obj
does not exist: 行工作,因为它提示说不存在
Obj
的错误:
function Player(x, y, z) {
this.Speed = 0;
this.AngleAcc = 0;
this.Angle = 0;
this.X=x;
this.Y=y;
this.Z=z;
this.MaxSpeed = 100;
var PlayerMateririal = new THREE.MeshLambertMaterial({ color: 0x00ff80, overdraw: 0.5 });
this.Obj = new THREE.Mesh(new THREE.BoxGeometry(50, 90, 60), PlayerMateririal);
scene.add(Obj);
Obj.position.set(x, y, z);
}
thanks i'm using Three.js and want to set the Obj
position in other locations hence why i'm setting it up as a property. 谢谢,我正在使用Three.js,并想在其他位置设置
Obj
位置,因此为什么要将它设置为属性。
使用这个关键字
scene.add(this.Obj);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.