flxldn
flxldn

Reputation: 61

Geometry from Scenekit primitives

I am successfully extracting vector data from SceneKit primitives, very much along the lines as in the question/answer here:

Extracting vertices from scenekit

This does not seem to work for all the geometries SceneKit generates though. I can extract the standard box, sphere etc, but special features like chamfer or more complex geometries (e.g. from SCNText) simply don't seem to be contained in the standard SceneKit geometry. Also: The normal SCNBox and SCNSphere only come in one geometry resolution and don't respect the parameters provided (e.g. different dimensions from 1.0).

Did anybody successfully extract the geometry from SCNText?

Thanks,

Felix

Upvotes: 6

Views: 1239

Answers (1)

Toyos
Toyos

Reputation: 4064

The underlying geometry data of these primitives are updated lazily at render time or when a transaction is flushed.

If you want to make sure that the data you will get from your primitives matches the latest parameter you configured then you need to either create and configure them within a SCNTransaction and access the geometry data after calling [SCNTranction commit] or you can invoke [SCNTransaction flush] before getting the data.

That should work for every primitive including SCNText.

Upvotes: 6

Related Questions