Table of Contents

Method AddHeightField

Namespace
Box3D
Assembly
Box3D.NET.dll

AddHeightField(HeightField, ShapeDefinition?)

Attaches a height field to this body, which must be static.

public Shape AddHeightField(HeightField heightField, ShapeDefinition? definition = null)

Parameters

heightField HeightField

The height field. It is not copied, so it must outlive this shape.

definition ShapeDefinition?

The shape settings, or null for the defaults.

Returns

Shape

The new shape.

Examples

using var terrain = HeightField.FromHeights(heights, 256, 256, new Vector3(1.0f, 100.0f, 1.0f));

Body ground = world.CreateStaticBody();
ground.AddHeightField(terrain);

Exceptions

ArgumentNullException

heightField is null.

ObjectDisposedException

heightField has been disposed.

InvalidOperationException

This body is not static.