Skip to content

Instantly share code, notes, and snippets.

@elijahzarlin
Created September 13, 2018 18:36
Show Gist options
  • Select an option

  • Save elijahzarlin/a781153d8200d3c31c31a1d98c3b9126 to your computer and use it in GitHub Desktop.

Select an option

Save elijahzarlin/a781153d8200d3c31c31a1d98c3b9126 to your computer and use it in GitHub Desktop.
world-scale-ar-3
internal extension matrix_float4x4 {
func rotationAroundY(radians: Float) -> matrix_float4x4 {
var matrix: matrix_float4x4 = self
matrix.columns.0.x = cos(radians)
matrix.columns.0.z = -sin(radians)
matrix.columns.2.x = sin(radians)
matrix.columns.2.z = cos(radians)
return matrix.inverse
}
func translationMatrix(_ translation : vector_float4) -> matrix_float4x4 {
var matrix: matrix_float4x4 = self
matrix.columns.3 = translation
return matrix
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment