FANDOM

540 Pages

This command will create a matrix to a given width and depth segmented into grid square of a specified arrangement.

 Syntax
MAKE MATRIX Matrix Number, Width, Depth, xDivisions, ZDivisions

 Parameters
Matrix Number is an integer value to be assigned to the matris


Width - is a float number giving the width of the surface along the x-axis

Depth - is a float number giving the depth of the plane along the z-axis

xDivisions - is an integer value specifying how many subdivisions are required along the x-axis

zDivisions - is an integer specifying how many subdivisions are required along the z-axis

 Returns

This command does not return a value.

 Description

A ground surface can be created using the terr\in objects commands. An alternative eay to create a surface that rises and falls is to use a matrix object. DarkBASIC Pro uses the term matrix to describe a 'plane' of 2 dimensions which can be divided into a number of rows and columns (known as subdivisions). This can be considered as a grid pattern of rectangles in the plane. Each rectangle is then divided into two triangles. Where the corners of individual triangle meet is called an 'apex'. Each apex can be manipulated up and down (along the y-axis) to create a 3d-surface. The surface can then be textured like any other object.

A matrix can be thought of as a grid landscape with individual tiles that can be textured, raised and lowered to create a wide variety of surfaces. The matrix number and division values should be integer values. The width and depth should be real numbers (floats).

 Example Code
ink rgb(255,255,255),0

position camera 0,300,0

autocam off

make matrix 1,1000,1000,25,25

position matrix 1,0,0,0

randomize matrix 1,rnd(100)

update matrix 1

do

loop

if matrix exist(1)=1 then delete matrix 1

end


﻿

﻿

Matrix Example
matrix01.dba
College Man
======================
Rem ** Set display mode (most systems should handle this)
Set Display Mode 1024, 768, 32

Rem ** Position camera for an overview of the matrix
Autocam off
position Camera 0, 500, 300, -600

Rem ** Create a grid (800 by 720)
Make Matrix 1, 800, 720, 8, 12

Rem ** Wait for key press
Wait Key

Rem ** Randomly adjust the y ordinates
Rem ** to a maximum of 45
Randomize Matrix 1, 45

Rem ** Update matrix
Update Matrix 1

Rem ** Wait for a key press to end the program
Wait Key
End﻿

Community content is available under CC-BY-SA unless otherwise noted.