Skip to content

raylib.GenMeshTorus

JoeStrout edited this page Oct 17, 2026 · 3 revisions

Generate torus mesh NOTE: The distance between the center of the hole and the center of the tube is half size of the radius of the tube (radius*size/2)

Parameters

Parameter Default Value Note
radius 1.0
size 0.5
radSeg 16
sides 16

Return value

Condition Return Value
(always) map

Notes

Example

camera = {position:[0,5,10], target:[0,0,0], up:[0,1,0], fovy:45, projection:raylib.CAMERA_PERSPECTIVE}
raylib.InitWindow 800, 600, "GenMeshTorus"
mesh = raylib.GenMeshTorus(0.4, 1, 16, 32)
model = raylib.LoadModelFromMesh(mesh)
while not raylib.WindowShouldClose
    raylib.BeginDrawing
    raylib.ClearBackground raylib.RAYWHITE
    raylib.BeginMode3D camera
    raylib.DrawGrid 10, 1.0
    raylib.DrawModel model, [0,0,0], 1.0, raylib.WHITE
    raylib.EndMode3D
    raylib.EndDrawing
end while
raylib.UnloadModel model
raylib.CloseWindow

Clone this wiki locally