CollisionHeightfield

class CollisionHeightfield

Bases: CollisionSolid

/*
  • CollisionHeightfield efficiently deals with collisions on uneven

  • terrain given a heightfield image. A quad tree is implemented to

  • significantly reduce the amount of triangles tested. Each quad

  • tree node represents a sub-rectangle of the heightfield image

  • and thus a box in 3D space.

  • */

Inheritance diagram

Inheritance diagram of CollisionHeightfield

CollisionHeightfield(PNMImage heightfield, PN_stdfloat max_height, int num_subdivisions)
static TypeHandle get_class_type(void)
PN_stdfloat get_height(int x, int y) const
PNMImage get_heightfield(void)
PN_stdfloat get_max_height(void)
int get_num_subdivisions(void)
void set_heightfield(PNMImage heightfield)
void set_max_height(PN_stdfloat max_height)
void set_num_subdivisions(int num_subdivisions)

Sets the number of quadtree subdivisions and modifies the quadtree accordingly. This should be called when a user wants to modify the number of quadtree subdivisions or from a constructor to initialize the quadtree.

If the number of subdivisions is too high, it will automatically be decremented.