Ortwin Gentz
Ortwin Gentz

Reputation: 54121

Can I read the transform matrix of an applied SCNConstraint?

I have applied an SCNBillboardConstraint to a node in my SceneKit scene. It works fine and the node orients itself towards the pointOfView.

Now I'd like to access the implicit transform matrix set by the constraint.

I need this to calculate the orientation of other sibling nodes that should be dependent of the orientation of my constraint node.

However, when I read the transform orientation or eulerAngles properties, they're all at their default and don't reflect the current "billboarded" orientation. The convertPosition(_:from:) API also seems to ignore the orientation set by the constraint.

Upvotes: 0

Views: 58

Answers (1)

Bartek
Bartek

Reputation: 26

I faced exactly the same problem. The solution for me was to look at the node's presentation object and read the transform matrix from there:

node.presentation.transform

Upvotes: 1

Related Questions