我用SCNBox创建SCNNode,
SCNBox *wallBox = [SCNBox boxWithWidth:width height:100 length:4 chamferRadius:0];
SCNMaterial *allMaterial = [SCNMaterial new];
allMaterial.diffuse.contents = @"allwall.png";
SCNMaterial *smallMaterial1 = [SCNMaterial new];
smallMaterial1.diffuse.contents =@"bottomwall.png";
SCNNode *rightwall = [SCNNode nodeWithGeometry:wallBox];
rightwall.geometry.materials = @[smallMaterial1,allMaterial,smallMaterial1,allMaterial,allMaterial,allMaterial];
但纹理方向的背面是错误的。
我希望两个方向相同,如何转换SCNMaterial的内容?如何使用" contentsTransform"?
答案 0 :(得分:1)
我使用这个答案解决了这个问题:SceneKit, flip direction of SCNMaterial
rightwall.geometry.materials = @[smallMaterial1,allMaterial,[smallMaterial1 copy],allMaterial,allMaterial,allMaterial];
NSArray *allMaterial = rightwall.geometry.materials;
SCNMaterial *smallMaterial2= allMaterial[2];
smallMaterial2.diffuse.contentsTransform = SCNMatrix4MakeScale(-1,1,1);
smallMaterial2.diffuse.wrapT = SCNWrapModeRepeat;
smallMaterial2.diffuse.wrapS = SCNWrapModeRepeat;