Javascript JSC3D:转换对象
我试图在空间中翻译对象,我有一个函数,它应该翻译对象,它存储在.js文件中Javascript JSC3D:转换对象,javascript,jsc3d,Javascript,Jsc3d,我试图在空间中翻译对象,我有一个函数,它应该翻译对象,它存储在.js文件中 JSC3D.Matrix3x4.prototype.translate = function(tx, ty, tz) { this.m03 += tx; this.m13 += ty; this.m23 += tz; }; 但在另一个js文件中,我试图实现实数并移动对象,如何调用此函数并更改其参数 在另一个文件查看器中也是如此。onmousedown=functionx,y,button,depth,mesh{if
JSC3D.Matrix3x4.prototype.translate = function(tx, ty, tz) {
this.m03 += tx;
this.m13 += ty;
this.m23 += tz;
};
但在另一个js文件中,我试图实现实数并移动对象,如何调用此函数并更改其参数 在另一个文件查看器中也是如此。onmousedown=functionx,y,button,depth,mesh{ifbutton==0/*left button down*/&&mesh!=null{//使用不同的蓝色创建新材质,例如var newMat=new JSC3D.material,0,0x000080,0,true;//将新材质设置为选定的网格网格。setMaterialnewMat;//告诉查看器渲染新的帧查看器。update;
JSC3D.Matrix3x4.prototype.translate = function(tx, ty, tz) {
var t=0;
var g=0;
var h=0;
t = parseFloat(document.getElementById('translate_x').value);
g = parseFloat(document.getElementById('translate_y').value);
h = parseFloat(document.getElementById('translate_z').value);
console.log(t);
if(t!=0 || g!=0 || h!=0)
{
console.log(this.m03);
this.m03 += tx;
this.m13 += ty;
this.m23 += tz;
tx=t;
ty=g;
tz=h;
this.m03 += tx;
this.m13 += ty;
this.m23 += tz;
}
else
{
this.m03 += tx;
this.m13 += ty;
this.m23 += tz;
}
};