0

I want to shear a SCNPlane like in the image below, but then on the Y-axis. So B and C are moved upwards instead of A and B to the right. I know there is a transform matrix needed to accomplish this, so I have tried to create this transform matrix like the code snippet below. But none of the possible options does give the desired result. Besides, the SCNPlane is rotated -90 around the X-axis. Maybe someone can show me what I'm doing wrong.

var transformMatrix = matrix_float4x4()
transformMatrix.columns.0 = [1.0, tan(60), 0.0, 0.0]
transformMatrix.columns.1 = [0.0, 1.0, 0.0, 0.0]
transformMatrix.columns.2 = [0.0, 0.0, 1.0, 0.0]
transformMatrix.columns.3 = [0.0, 0.0, 0.0, 1.0]

let newTransform = matrix_multiply(transformMatrix, simd_float4x4((transformPlane?.transform)!))
transformPlane?.simdTransform = newTransform

I got the transform matrix from the answer to this question (number 3).

enter image description here

KNV
  • 631
  • 4
  • 19
  • Not sure it’s related to the problem, but why convert from SIMD matrix to SceneKit matrix for a multiply only to convert back to SIMD? – rickster Jun 15 '18 at 01:41
  • @rickster I updated my question and code to your answer. This doesn't work neither, the plane is only rotating. – KNV Jun 15 '18 at 07:46

0 Answers0