R3d.HeightFieldShape

From GiderosMobile
Revision as of 03:02, 23 January 2020 by MoKaLux (talk | contribs)

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2019.10

Description

Once you have created a rigid body in the world, you need to add one or more collision shapes to it so that it is able to collide with other bodies.

The collision shapes are also the way to represent the mass of a Rigid Body. Whenever you add a collision shape to a rigid body, you need to specify the mass of the shape. Then the rigid body will recompute its total mass, its center of mass and its inertia tensor taking into account all its collision shapes.

Height Field Shape

The HeightFieldShape is a collision shape that can be used to represent a static terrain for instance.

You can define a heightfield with a two dimensional grid that has a given height value at each point. In order to create a HeightFieldShape, you need to have an array with all the height values of your field. You can have height values of type int, float or double. You need to give the number of rows and columns of your two dimensional grid.

notes: the height values in your array must be organized such that the value at row indexRow and column indexColumn is located at the following position in the array:

heighFieldValues[indexRow * nbColumns + indexColumn]

Morevover, you need to provide the minimum and maximum height values of your height field.

Methods

r3d.HeightFieldShape.new creates a new collision height field shape



ReactPhysics3D