====== Movement using matrix4x4 ====== In this example, we will be using matrix4x4 the transformation matrix to move a SubItem object.\\ The example script turns the object by 1 degree per frame around the Z-axis. === Example data === https://virtualcast.jp/products/93ab24411da7edf1bdbf503c30d82fee0b1117c0d87536101d2944eae7a4fdd0 === Unitypackage === {{ :vci:sample:sample_advanced:tutorial_matrix4x4.unitypackage |}} local m = Matrix4x4.zero local sub = vci.assets.GetTransform("sub") local baseposition local baserotation local basescale local rotq local rotation = Quaternion.Euler(0, 0, 1)--Local rotation local translation = Vector3.__new(0,0,0)--Local transpose local scale = Vector3.__new(1,1,1)--Local scale function updateAll() baseposition = sub.GetLocalPosition()--Vector3 baserotation = sub.GetLocalRotation()--Quaternion basescale = sub.GetLocalScale()--Vector3 m.setTRS(translation,rotation,scale)--Set a transformation matrix on m rotq = m.rotation --Quaternion solved by the transformation matrix baserotation = rotq*baserotation baseposition = m.MultiplyPoint3x4(baseposition)--Can be used for parallel translation basescale = Vector3.__new(scale.x*basescale.x,scale.y*basescale.y,scale.z*basescale.z) sub.SetLocalRotation(baserotation)--Apply the rotation sub.SetLocalPosition(baseposition)--Apply the position sub.SetLocalScale(basescale)--Apply the scale end