Jsc3d: Translating Object
I am trying to translate object in space, and I have this function which should translate object, its stored in .js file JSC3D.Matrix3x4.prototype.translate = function(tx, ty, tz)
Solution 1:
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;
}
};
Post a Comment for "Jsc3d: Translating Object"