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
heightFieldHeightField-
The height field. It is not copied, so it must outlive this shape.
definitionShapeDefinition?-
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
-
heightFieldis null. - ObjectDisposedException
-
heightFieldhas been disposed. - InvalidOperationException
-
This body is not static.