Geometry from Scenekit primitives

I am successfully extracting vector data from SceneKit primitives, very strongly line by line, as in the question / answer:

Extracting vertices from a script

This does not seem to work for all geometries created by SceneKit. I can extract a standard box, sphere, etc., but special functions, such as a chamfer or more complex geometries (for example, from SCNText), are simply not contained in the standard SceneKit geometry. Also: regular SCNBox and SCNSphere have only one geometry resolution and do not take into account the provided parameters (for example, different sizes from 1.0).

Has anyone successfully retrieved geometry from SCNText?

Thanks,

Felix

+4
source share
1 answer

The geometry data of these primitives is updated lazily during rendering or when painting a transaction.

If you want to make sure that the data that you get from your primitives matches the last parameter that you configured, you need to either create it or configure it in SCNTransaction , and access the geometric data after calling [SCNTranction commit] , or you can call [SCNTransaction flush] before receiving data.

This should work for every primitive, including SCNText .

+5
source

Source: https://habr.com/ru/post/1492442/


All Articles