ReactPhysics3D  v0.10.2
C++ Physics engine library
Loading...
Searching...
No Matches
reactphysics3d::HeightFieldShape Class Reference

This class represents a static height field that can be used to represent a terrain. More...

#include <include/reactphysics3d/collision/shapes/HeightFieldShape.h>

Inheritance diagram for reactphysics3d::HeightFieldShape:
reactphysics3d::ConcaveShape reactphysics3d::CollisionShape

Public Member Functions

 HeightFieldShape (const HeightFieldShape &shape)=delete
 Deleted copy-constructor.
 
HeightFieldShapeoperator= (const HeightFieldShape &shape)=delete
 Deleted assignment operator.
 
HeightFieldgetHeightField () const
  Return a pointer to the internal height-field
 
Vector3 getVertexAt (uint32 x, uint32 y) const
 Return the vertex (local-coordinates) of the height field at a given (x,y) position.
 
virtual AABB getLocalBounds () const override
 Return the local bounds of the shape in x, y and z directions.
 
virtual void computeOverlappingTriangles (const AABB &localAABB, Array< Vector3 > &triangleVertices, Array< Vector3 > &triangleVerticesNormals, Array< uint32 > &shapeIds, MemoryAllocator &allocator) const override
 Use a callback method on all triangles of the concave shape inside a given AABB.
 
virtual std::string to_string () const override
 Return the string representation of the shape.
 
- Public Member Functions inherited from reactphysics3d::ConcaveShape
 ConcaveShape (CollisionShapeName name, MemoryAllocator &allocator, const Vector3 &scaling)
 Constructor.
 
virtual ~ConcaveShape () override=default
 Destructor.
 
 ConcaveShape (const ConcaveShape &shape)=delete
 Deleted copy-constructor.
 
ConcaveShapeoperator= (const ConcaveShape &shape)=delete
 Deleted assignment operator.
 
TriangleRaycastSide getRaycastTestType () const
 Return the raycast test type (front, back, front-back)
 
void setRaycastTestType (TriangleRaycastSide testType)
 
const Vector3getScale () const
 Return the scale of the shape.
 
virtual void setScale (const Vector3 &scale)
 Set the scale of the shape.
 
virtual Vector3 getLocalInertiaTensor (decimal mass) const override
 Return the local inertia tensor of the collision shape.
 
virtual bool isConvex () const override
 Return true if the collision shape is convex, false if it is concave.
 
virtual bool isPolyhedron () const override
 Return true if the collision shape is a polyhedron.
 
virtual decimal getVolume () const override
 Compute and return the volume of the collision shape.
 
- Public Member Functions inherited from reactphysics3d::CollisionShape
 CollisionShape (CollisionShapeName name, CollisionShapeType type, MemoryAllocator &allocator)
 Constructor.
 
virtual ~CollisionShape ()=default
 Destructor.
 
 CollisionShape (const CollisionShape &shape)=delete
 Deleted copy-constructor.
 
CollisionShapeoperator= (const CollisionShape &shape)=delete
 Deleted assignment operator.
 
CollisionShapeName getName () const
 Return the name of the collision shape.
 
CollisionShapeType getType () const
 Return the type of the collision shape.
 
uint32 getId () const
 Return the id of the shape.
 
virtual AABB computeTransformedAABB (const Transform &transform) const
 Compute the transformed AABB of the collision shape given a transform.
 

Detailed Description

This class represents a static height field that can be used to represent a terrain.

The height field is made of a grid with rows and columns with a height value at each grid point. Note that the height values are not copied into the shape but are shared instead. The height values can be of type integer, float or double. When creating a HeightFieldShape, you need to specify the minimum and maximum height value of your height field. Note that the HeightFieldShape will be re-centered based on its AABB. It means that for instance, if the minimum height value is -200 and the maximum value is 400, the final minimum height of the field in the simulation will be -300 and the maximum height will be 300.

Member Function Documentation

◆ computeOverlappingTriangles()

void HeightFieldShape::computeOverlappingTriangles ( const AABB localAABB,
Array< Vector3 > &  triangleVertices,
Array< Vector3 > &  triangleVerticesNormals,
Array< uint32 > &  shapeIds,
MemoryAllocator allocator 
) const
overridevirtual

Use a callback method on all triangles of the concave shape inside a given AABB.

Implements reactphysics3d::ConcaveShape.

◆ getLocalBounds()

AABB HeightFieldShape::getLocalBounds ( ) const
overridevirtual

Return the local bounds of the shape in x, y and z directions.

Returns
The AABB with the min/max bounds of the shape

Implements reactphysics3d::CollisionShape.

◆ to_string()

std::string HeightFieldShape::to_string ( ) const
overridevirtual

Return the string representation of the shape.

Implements reactphysics3d::CollisionShape.


The documentation for this class was generated from the following files: