Skip to content

VertexCoords

Narta Xaymar Dirks edited this page Oct 28, 2026 · 5 revisions
Blitz3D

VertexCoords

VertexCoords:Void surface:Int32, index:Int32, x:Float32, y:Float32, z:Float32
Parameter Mode Type Default Description
surface In Int32 required Surface handle.
index In Int32 required Index of the vertex, from 0.
x In Float32 required New X position.
y In Float32 required New Y position.
z In Float32 required New Z position.

Description

Moves an existing vertex to a new position in the space of the mesh. Every triangle that uses the vertex follows, so changing vertices every frame deforms a mesh: waves on water, a flag in the wind or a dent in a car. Call UpdateNormals afterwards if the lighting should follow the new shape.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
PositionEntity camera, 0, 6, -7
RotateEntity camera, 38, 0, 0
light = CreateLight()
RotateEntity light, 40, 60, 0
mesh = CreateMesh()
surf = CreateSurface(mesh)
For z = 0 To 15
	For x = 0 To 15
		AddVertex surf, x * 0.5 - 3.75, 0, z * 0.5 - 3.75
	Next
Next
For z = 0 To 14
	For x = 0 To 14
		i = z * 16 + x
		AddTriangle surf, i, i + 16, i + 1
		AddTriangle surf, i + 1, i + 16, i + 17
	Next
Next
EntityColor mesh, 80, 150, 230
t = 0
While Not KeyHit(1)
	t = t + 12
	For i = 0 To CountVertices(surf) - 1
		VertexCoords surf, i, VertexX(surf, i), Sin(t + VertexX(surf, i) * 90) * 0.4, VertexZ(surf, i)
	Next
	UpdateNormals mesh
	RenderWorld
	Flip
Wend

Media

VertexCoords

Related Commands

VertexAlpha, VertexBlue, VertexColor, VertexGreen, VertexNormal, VertexNX, VertexNY, VertexTexCoords

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally