我正在尝试在空间中翻译对象,我有这个函数,它应该翻译对象,它存储在.js文件中
JSC3D.Matrix3x4.prototype.translate = function(tx, ty, tz) {
this.m03 += tx;
this.m13 += ty;
this.m23 += tz;
};但是在另一个js文件中,我正在尝试实现实数和移动对象,我如何调用这个函数并改变它的参数?
发布于 2015-09-12 05:30:45
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;
}
};https://stackoverflow.com/questions/32454569
复制相似问题