Skip to content
This repository was archived by the owner on Jul 12, 2026. It is now read-only.
This repository was archived by the owner on Jul 12, 2026. It is now read-only.

TriMesh should have better documentation. Example included. #272

Description

@jonmdev

Based on the minimal documentation we have, if I want to create a TriMesh floor made of a single triangle, this should I think look like this:

	let triMeshVerts = new Float32Array(9);

	triMeshVerts[0] = -9; 	triMeshVerts[1] = 0;	triMeshVerts[2] = 9;	//point 1 x,y,z
	triMeshVerts[3] = 9;	triMeshVerts[4] = 0;	triMeshVerts[5] = 9;	//point 2 x,y,z
	triMeshVerts[6] = 0;	triMeshVerts[7] = 0;	triMeshVerts[8] = -9;	//point 3 x,y,z

	let triMeshIndices = new Uint32Array(9);
	
	for (let i=0;i<triMeshIndices.length;i++){
		triMeshIndices[i] = 0; //all points used for single triangle
	}
	let groundColliderDesc = RAPIER.ColliderDesc.trimesh(triMeshVerts,triMeshIndices).setTranslation(0,0,0);
	

However, objects fall right through this. Is there some other step that needs to be done or is this function broken?

By contrast, if I make a triangle with the same points it works properly and stops objects from going through it:

let groundColliderDesc = RAPIER.ColliderDesc.triangle(new RAPIER.Vector3(-9,0,9), new RAPIER.Vector3(9,0,9), new RAPIER.Vector3(0,0,-9)).setTranslation(0,0,0);
    world.createCollider(groundColliderDesc);

Thanks for any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions