I am trying to make a ray-triangle intersection for a library that I am working on.
My problem is not the actual ray-intersection algorithm, since I already have that ready. My issue is that I cannot access the individual vertices/lineVertices of each shape, which I need for the algorithm.
function setup () {
createCanvas(500, 500, WEBGL);
}
function draw() {
background(220);
push();
translate(0,100,0)
box();
for(let i = 0; i < 3; i++){
push();
points = this._renderer.retainedMode.geometry['box|4|4'].model.vertices[(i+pointCounter)%this._renderer.retainedMode.geometry['box|4|4'].model.vertices.length];
points = [points.x, points.y, points.z]
//console.log(points)
vec3.scale(points, points, 50);
//translate(0,200,0);
point(points[0],points[1],points[2]);
pointCounter++
pop();
}
function keyPressed(){
console.log(this._renderer.retainedMode.geometry['box|4|4'])
}
This is just some sample code that I have to show y’all what I have so far.
Is there an easier way to access the faces, like accessing one of the webGL buffers (which I don’t know how to do) or am I looking in the wrong places?
Help would really be appreciated!
-Sam