Change the color or texture of a SCNText node obje

2019-01-19 22:31发布

How do I set the texture of a SCNText object? This is what I have and nothing changes in the appearance:

// myNode is a working SCNText element 

let mat = SCNMaterial()
met.diffuse.contents = UIImage(contentsOfFile: "texture.png")
myNode.geometry.firstMaterial = mat

1条回答
可以哭但决不认输i
2楼-- · 2019-01-19 23:17

A text geometry may contain one, three, or five geometry elements:

If its extrusionDepth property is 0.0, the text geometry has one element corresponding to its one visible side. If its extrusion depth is greater than zero and its chamferRadius property is 0.0, the text geometry has three elements, corresponding to its front, back, and extruded sides. If both extrusion depth and chamfer radius are greater than zero, the text geometry has five elements, corresponding to its front, back, extruded sides, front chamfer, and back chamfer. Scene Kit can render each element using a different material. For details, see the description of the materials property in SCNGeometry Class Reference.

just like for any other geometry, simply set its materials property.

查看更多
登录 后发表回答