Now I know what's solution.
First
Don't load .dae file as the SCNScene. You are supported to use .scn file. The error happened because I use .dae file to modify texture in Scene Editor. Then I couldn't get the same result when I run it. After I changed it to .scn file and modify the texture. I get the right effect on real Device. You can simply convert .dae to .scn file by ->Editor->Convert to SceneKit scene file format.
Second
Both offset and Scale value affect the value of contentsTransform
property. I have modify the texture in the material Editor View. if the offSet is (0, -4.03) and the Scale is (1, 1.714) the contentsTransform
property is SCNMatrix4(m11: 1.0, m12: 0.0, m13: 0.0, m14: 0.0, m21: 0.0, m22: 1.714, m23: 0.0, m24: 0.0, m31: 0.0, m32: 0.0, m33: 1.0, m34: 0.0, m41: 0.0, m42: -4.03, m43: 0.0, m44: 1.0)
. By searching the doc, I found that how to get this property.
var matrixA = SCNMatrix4MakeTranslation(0, -4.0, 0)
var matrixB = SCNMatrix4MakeScale(1, 1.345, 1)
var b = SCNMatrix4Mult(matrixB, matrixA)
Make sure it is MakeScale * MakeTranslation