Hello I'm making simple renderer using Three.js
I wanna make Game_Object class work like THREE.Mesh class
but the code couldn't get 'this' object in lower function.
so I found other similar case. but It also didn't work ...
how can I solve this problem?
class Game_Object{
constructor(geometry, material){
this.object = new THREE.Mesh(geometry, material);
}
position = {
This : this,
get x(){return This.object.position.x * 100.0},
set x(x){This.object.position.x = x / 100.0 },
get y(){return This.object.position.y * 100.0},
set y(y){This.object.position.y = y / 100.0 },
get z(){return This.object.position.z * 100.0},
set z(z){This.object.position.z = z / 100.0 },
set: function(x,y,z){ This.object.position.set(x / 100.0, y / 100.0, z / 100.0); }
}
}
This is when I find myobject.position.x++ in console
This is when I find myobject.position.This in console