diff --git a/mat3/mat3.go b/mat3/mat3.go index 078a109..675ebff 100644 --- a/mat3/mat3.go +++ b/mat3/mat3.go @@ -178,8 +178,8 @@ func (mat *T) AssignMat2x2(m *mat2.T) *T { func (mat *T) MulVec3(v *vec3.T) vec3.T { return vec3.T{ mat[0][0]*v[0] + mat[1][0]*v[1] + mat[2][0]*v[2], - mat[0][1]*v[1] + mat[1][1]*v[1] + mat[2][1]*v[2], - mat[0][2]*v[2] + mat[1][2]*v[1] + mat[2][2]*v[2], + mat[0][1]*v[0] + mat[1][1]*v[1] + mat[2][1]*v[2], + mat[0][2]*v[0] + mat[1][2]*v[1] + mat[2][2]*v[2], } } diff --git a/vec3/vec3.go b/vec3/vec3.go index 23f6e27..3ee8b60 100644 --- a/vec3/vec3.go +++ b/vec3/vec3.go @@ -107,10 +107,12 @@ func (vec *T) LengthSqr() float32 { } // Scale multiplies all element of the vector by f and returns vec. -func (vec *T) Scale(f float32) { +func (vec *T) Scale(f float32) *T { vec[0] *= f vec[1] *= f vec[2] *= f + + return vec } // Scaled returns a copy of vec with all elements multiplies by f.