Returns vertex normal Y component (negated to match Y+ = up convention).
Takes mesh (surface-based mesh entity), surface (surface handle, 0-based), vertexIndex (vertex number, 0-based).
Returns normal Y as double or 0.
3D Graphics
Parameters & Returns
Parameters
meshInt
surfaceInt
vertexIndexInt
Returns
Double
Quick Summary
Returns vertex normal Y component (negated to match Y+ = up convention).
Takes mesh (surface-based mesh entity), surface (surface handle, 0-based), vertexIndex (vertex number, 0-based).
Returns normal Y as double or 0.
Technical Exegesis...
Returns vertex normal Y component (negated to match Y+ = up convention). Takes mesh (surface-based mesh entity), surface (surface handle, 0-based), vertexIndex (vertex number, 0-based). Returns normal Y as double or 0.0 on error. Validates mesh exists, type is ENTITY_MESH, is surface-based, surface index valid, and vertex index valid. Returns -surface->vertices[vertexIndex].normal.y (negated). Returns 0.0 if: invalid mesh, not surface-based, invalid surface, vertex index out of range.
Returns vertex normal Y component (negated to match Y+ = up convention). Takes mesh (surface-based mesh entity), surface (surface handle, 0-based), vertexIndex (vertex number, 0-based). Returns normal Y as double or 0.0 on error. Validates mesh exists, type is ENTITY_MESH, is surface-based, surface index valid, and vertex index valid. Returns -surface->vertices[vertexIndex].normal.y (negated). Returns 0.0 if: invalid mesh, not surface-based, invalid surface, vertex index out of range.
This function retrieves vertex normal Y component with coordinate system conversion. CRITICAL: Y-axis negation applied - DirectX stores Y- = up internally, BambooBasic presents Y+ = up to user. Normal negation ensures: upward-pointing normals return positive NY (e.g., NY=1.0 for flat ground pointing up), consistent Y-up coordinate system matches position queries. When normal points straight up: internal normal.y = -1.0 (DirectX Y-down), b3dVertexNY returns +1.0 (user Y-up). Normal range: -1.0 to +1.0 (normalized vector component). Return value 0.0 ambiguous (could be normal parallel to XZ-plane or error). Use cases: (1) Ground detection (NY close to 1.0 = horizontal surface, close to 0.0 = vertical wall), (2) Slope calculation (arccos(NY) = angle from vertical), (3) Lighting (NY affects top/bottom lighting contribution), (4) Surface classification (floors vs walls vs ceilings by NY threshold). Common pattern: For i=0 To b3dCountVertices(mesh, surf)-1, nx=b3dVertexNX(mesh, surf, i), ny=b3dVertexNY(mesh, surf, i), nz=b3dVertexNZ(mesh, surf, i), If ny > 0.7 Then Print "Vertex " + i + " on walkable surface" (0.7 ~ 45 degrees slope). Symmetry: b3dVertexNormal negates NY on input, b3dVertexNY negates NY on output - round-trip preserves value. Ground normal example: flat ground has normal (0, 1, 0) in user space = pointing straight up. Ceiling normal example: flat ceiling has normal (0, -1, 0) = pointing down. b3dUpdateNormals: calculates normals from triangle geometry, automatically handles Y-negation. Default normal: b3dAddVertex sets (0, -1, 0) internally = (0, 1, 0) when read via b3dVertexNY. Precision: double precision. Typical values: horizontal surface NY ~ 1.0, vertical surface NY ~ 0.0, 45 degrees slope NY ~ 0.707, inverted surface (ceiling) NY ~ -1.0. Alternative: calculate from triangle cross product, use for bump mapping, surface normal visualization.