SCNText Alignment not working in iOS

I tried the correct alignment, but it is still aligned.

let txt = SCNText(string: "TEST", extrusionDepth: 10) 
txt.chamferRadius = 5 //0<chamfer<extrusion depth
txt.firstMaterial.diffuse.contents  = UIColor.whiteColor() 
txt.containerFrame = CGRectMake(-200, -150, 400, 200) //on iPad Air Sim in Landscape
txt.wrapped = true
txt.alignmentMode = kCAAlignmentRight

What's wrong?

Thank!

+4
source share
1 answer

It seems that alignment works - try adding a second line to your test line, for example "TEST\nT", and switching between alignment modes left and right. But it SCNTextadapts to the coordinate system of its node, so alignment itself will not necessarily make the text fit your scene the way you want.

, node , node pivot. (SCNMatrix4MakeTranslation) , , .

+6

All Articles