scntext

Swift Scenekit - Centering SCNText - the getBoundingBoxMin:Max issue

左心房为你撑大大i 提交于 2020-01-01 10:06:16
问题 Having fun with the alignmentMode option on SCNText. Been googling around and it looks like there is a problem with alignmentMode and containerFrame. The alternatives I've found suggest using the get bounding box function to find the text size and then manually adjust accordingly. Great except I cant get the function to work. When I try to get the two vectors I get an error: 'SCNVector3' is not convertible to 'UnsafeMutablePointer < SCNVector3>' I get that both on the geometry and the node.

ARKit - How to contain SCNText within another SCNNode (speech bubble)

落花浮王杯 提交于 2019-12-21 06:23:09
问题 I am trying to create a quote generator with simple text within a speech bubble in ARKit. I can show the speech bubble with text, but the text always starts in the middle and overflows outside of the speech bubble. Any help getting it align in the top left of the speech bubble and wrapping within the speech bubble would be appreciated. Result Classes class SpeechBubbleNode: SCNNode { private let textNode = TextNode() var string: String? { didSet { textNode.string = string } } override init()

ARKit - How to contain SCNText within another SCNNode (speech bubble)

耗尽温柔 提交于 2019-12-21 06:23:06
问题 I am trying to create a quote generator with simple text within a speech bubble in ARKit. I can show the speech bubble with text, but the text always starts in the middle and overflows outside of the speech bubble. Any help getting it align in the top left of the speech bubble and wrapping within the speech bubble would be appreciated. Result Classes class SpeechBubbleNode: SCNNode { private let textNode = TextNode() var string: String? { didSet { textNode.string = string } } override init()

SCNText - background “speech bubble”

廉价感情. 提交于 2019-12-11 05:07:02
问题 How can I insert a background (e.g. a "speech bubble" or a rectangle) to a SCNtext? Specifically, if I insert "Hello World" as SCNText (and obviously then as a SCNNode in the scene) then how can I add a background for that text only? Would it be a UIimage which will be inserted as a SCNNode at the same position in the "Hello World? (Keep in mind that there is nothing as background of SCNNode in SceneKit) 回答1: You could use a SCNPlane as another SCNNode, assign a SCNMaterial to its geometry,

Swift Scenekit - Centering SCNText - the getBoundingBoxMin:Max issue

微笑、不失礼 提交于 2019-12-04 06:41:35
Having fun with the alignmentMode option on SCNText. Been googling around and it looks like there is a problem with alignmentMode and containerFrame. The alternatives I've found suggest using the get bounding box function to find the text size and then manually adjust accordingly. Great except I cant get the function to work. When I try to get the two vectors I get an error: 'SCNVector3' is not convertible to 'UnsafeMutablePointer < SCNVector3>' I get that both on the geometry and the node. example of the code is below func setCounterValue(counterValue:Int) { var v1 = SCNVector3(x: 0,y: 0,z: 0

ARKit - How to contain SCNText within another SCNNode (speech bubble)

自作多情 提交于 2019-12-03 20:53:06
I am trying to create a quote generator with simple text within a speech bubble in ARKit. I can show the speech bubble with text, but the text always starts in the middle and overflows outside of the speech bubble. Any help getting it align in the top left of the speech bubble and wrapping within the speech bubble would be appreciated. Result Classes class SpeechBubbleNode: SCNNode { private let textNode = TextNode() var string: String? { didSet { textNode.string = string } } override init() { super.init() // Speech Bubble let plane = SCNPlane(width: 200.0, height: 100.0) plane.cornerRadius =

SceneKit - SCNText centering incorrectly

拥有回忆 提交于 2019-11-30 15:01:25
I have tried to make a text string (SCNText) fit inside a box (SCNBox) in the code below. The size of the box looks correct but the text is not in the right center of the box. Any idea or solution? Thanks let geoText = SCNText(string: "Hello", extrusionDepth: 1.0) geoText.font = UIFont (name: "Arial", size: 8) geoText.firstMaterial!.diffuse.contents = UIColor.red let textNode = SCNNode(geometry: geoText) let (minVec, maxVec) = textNode.boundingBox scnScene.rootNode.addChildNode(textNode) let w = CGFloat(maxVec.x - minVec.x) let h = CGFloat(maxVec.y - minVec.y) let d = CGFloat(maxVec.z - minVec

SceneKit - SCNText centering incorrectly

二次信任 提交于 2019-11-29 21:13:59
问题 I have tried to make a text string (SCNText) fit inside a box (SCNBox) in the code below. The size of the box looks correct but the text is not in the right center of the box. Any idea or solution? Thanks let geoText = SCNText(string: "Hello", extrusionDepth: 1.0) geoText.font = UIFont (name: "Arial", size: 8) geoText.firstMaterial!.diffuse.contents = UIColor.red let textNode = SCNNode(geometry: geoText) let (minVec, maxVec) = textNode.boundingBox scnScene.rootNode.addChildNode(textNode) let