R3d.HeightFieldShape.new: Difference between revisions

From GiderosMobile
improved doc + added example
m Text replacement - "<source" to "<syntaxhighlight"
Line 4: Line 4:
=== Description ===
=== Description ===
Creates a new collision height field shape (fixture).
Creates a new collision height field shape (fixture).
<source lang="lua">
<syntaxhighlight lang="lua">
r3d.HeightFieldShape.new(nbColumns,nbRows,minAltitude,maxAltitude,heights)
r3d.HeightFieldShape.new(nbColumns,nbRows,minAltitude,maxAltitude,heights)
</source>
</source>
Line 17: Line 17:
=== Example ===
=== Example ===
'''A simple terrain'''
'''A simple terrain'''
<source lang="lua">
<syntaxhighlight lang="lua">
local nbc, nbr = 4, 4
local nbc, nbr = 4, 4
local minh, maxh = 0, 2
local minh, maxh = 0, 2

Revision as of 13:30, 13 July 2023

Available since: Gideros 2019.10
Class: R3d.HeightFieldShape

Description

Creates a new collision height field shape (fixture). <syntaxhighlight lang="lua"> r3d.HeightFieldShape.new(nbColumns,nbRows,minAltitude,maxAltitude,heights) </source>

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 <syntaxhighlight 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>