# BulletTriangleMesh¶

from panda3d.bullet import BulletTriangleMesh

class BulletTriangleMesh

Bases: TypedWritableReferenceCount

Inheritance diagram

__init__()
addArray(points: panda3d.core.PTA_LVecBase3, indices: panda3d.core.PTA_int, remove_duplicate_vertices: bool)None

Adds triangle information from an array of points and indices referring to these points. This is more efficient than adding triangles one at a time.

If remove_duplicate_vertices is true, it will make sure that it does not add duplicate vertices if they already exist in the triangle mesh, within the tolerance specified by setWeldingDistance(). This comes at a significant performance cost, especially for large meshes.

addGeom(geom: panda3d.core.Geom, remove_duplicate_vertices: bool, ts: panda3d.core.TransformState)None

Adds the geometry from the indicated Geom from the triangle mesh. This is a one-time copy operation, and future updates to the Geom will not be reflected.

If remove_duplicate_vertices is true, it will make sure that it does not add duplicate vertices if they already exist in the triangle mesh, within the tolerance specified by setWeldingDistance(). This comes at a significant performance cost, especially for large meshes.

addTriangle(p0: panda3d.core.LPoint3, p1: panda3d.core.LPoint3, p2: panda3d.core.LPoint3, remove_duplicate_vertices: bool)None

Adds a triangle with the indicated coordinates.

If remove_duplicate_vertices is true, it will make sure that it does not add duplicate vertices if they already exist in the triangle mesh, within the tolerance specified by setWeldingDistance(). This comes at a significant performance cost, especially for large meshes.

static getClassType()panda3d.core.TypeHandle
getNumTriangles()int

Returns the number of triangles in this triangle mesh.

getWeldingDistance()float

Returns the value previously set with setWeldingDistance(), or the value of 0 if none was set.

output(out: panda3d.core.ostream)None
preallocate(num_verts: int, num_indices: int)None

Used to reserve memory in anticipation of the given amount of vertices and indices being added to the triangle mesh. This is useful if you are about to call addTriangle() many times, to prevent unnecessary reallocations.

setWeldingDistance(distance: float)None

Sets the square of the distance at which vertices will be merged together when adding geometry with remove_duplicate_vertices set to true.

The default is 0, meaning vertices will only be merged if they have the exact same position.

property triangles → Sequence[LVecBase3i]

Returns the vertex indices making up the given triangle index.

property vertices → Sequence[LPoint3]

Returns the vertex at the given vertex index.

property welding_distancefloat
Getter

Returns the value previously set with setWeldingDistance(), or the value of 0 if none was set.

Setter

Sets the square of the distance at which vertices will be merged together when adding geometry with remove_duplicate_vertices set to true.

The default is 0, meaning vertices will only be merged if they have the exact same position.

write(out: panda3d.core.ostream, indent_level: int)None