R3d.HeightFieldShape.new: Difference between revisions

From GiderosMobile
Created page with "'''Available since:''' Gideros 2019.10<br/> '''Class:''' R3d.HeightFieldShape<br/> === Description === Creates a new collision height field shape (fixture). <source lang=..."
 
improved doc + added example
Line 5: Line 5:
Creates a new collision height field shape (fixture).
Creates a new collision height field shape (fixture).
<source lang="lua">
<source lang="lua">
r3d.HeightFieldShape.new(width,height,minAltitude,maxAltitude,field)
r3d.HeightFieldShape.new(nbColumns,nbRows,minAltitude,maxAltitude,heights)
</source>
</source>


=== Parameters ===
=== Parameters ===
'''width''': (number) the width of the shape<br/>
'''nbColumns''': (number) the number of columns in the shape<br/>
'''height''': (number) the height of the shape<br/>
'''nbRows''': (number) the number of rows in the shape<br/>
'''minAltitude''': (number)  the minimum point altitude of the shape<br/>
'''minAltitude''': (number)  the minimum point altitude of the shape<br/>
'''maxAltitude''': (number)  the maximum point altitude of the shape<br/>
'''maxAltitude''': (number)  the maximum point altitude of the shape<br/>
'''field''': (table) the field table of the shape<br/>
'''heights''': (table) the heights table of the shape<br/>


=== Example ===
=== Example ===
'''A simple terrain'''
<source lang="lua">
<source lang="lua">
local nbc, nbr = 4, 4
local minh, maxh = 0, 2
local ht = {
0,0,0,0,
0,2,2,0,
0,2,2,0,
0,0,0,0,
}
local shape = r3d.HeightFieldShape.new(nbc, nbr, minh, maxh, ht)
</source>
</source>


{{R3d.HeightFieldShape}}
{{R3d.HeightFieldShape}}

Revision as of 20:38, 21 March 2021

Available since: Gideros 2019.10
Class: R3d.HeightFieldShape

Description

Creates a new collision height field shape (fixture).

r3d.HeightFieldShape.new(nbColumns,nbRows,minAltitude,maxAltitude,heights)

Parameters

nbColumns: (number) the number of columns in the shape
nbRows: (number) the number of rows in the shape
minAltitude: (number) the minimum point altitude of the shape
maxAltitude: (number) the maximum point altitude of the shape
heights: (table) the heights table of the shape

Example

A simple terrain

local nbc, nbr = 4, 4
local minh, maxh = 0, 2
local ht = {
	0,0,0,0,
	0,2,2,0,
	0,2,2,0,
	0,0,0,0,
}
local shape = r3d.HeightFieldShape.new(nbc, nbr, minh, maxh, ht)