Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 705
flxldn Avatar asked Jul 20 '13 08:07

flxldn


People also ask

What is SceneKit used for?

SceneKit is a high-level 3D graphics framework that helps you create 3D animated scenes and effects in your apps.

What is Scnbox?

A six-sided polyhedron geometry whose faces are all rectangles, optionally with rounded edges and corners.

What is node in ARKit?

In my previous blog post I discussed how to overlay an image on the camera output in an ARKit app. Objects that you overlay on the camera output are called nodes. By default, nodes don't have a shape. Instead, you give them a geometry (shape) and apply materials to the geometry to provide a visual appearance.


1 Answers

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.

like image 131
Toyos Avatar answered Oct 04 '22 08:10

Toyos