Contents

position(at:)

Returns the position of the vertex at the given index.

Declaration

final func position(at vertexIndex: UInt32) -> SIMD3<Float>

Parameters

  • vertexIndex:

    Index of the vertex to get the position for.

Return Value

The position of the specified vertex.

Discussion

If you want to obtain the position for a specific vertex within a specific primitive (for example the third vertex of the 20th triangle in a triangle mesh), you can use vertexIndex(at:) to obtain the right vertex index:

let vertexIndex = myMesh.vertexIndex(at: 3 * 19 + 2)
let vertexPosition = myMesh.position(at: vertexIndex)
print("The third vertex of the 20th triangle is at X=\(vertexPosition.x)")

See Also

Accessing vertex data