We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm looking for a way to texture body objects made with Matter.js with snapshots taken from a webcam. For example, every time I call mousePressed() two things happen: 1) a new body is created and 2) a frame from the webcam is pushed into an array. I want to use a new image from that array to texture each new rectangular body. Do I need to somehow use the render/sprite option within Matter.js or can I somehow just use p5 to do this? Thanks for any suggestions!
Here are the two pertinent files:
Answers
okay Somehow I figured it out, although I'm sure it's not sound. Here is the working code for using a section of the webcam image to be shown. This is NOT dynamic as it is not a sprite texture, it all happens in the this.show() of the body. I know there is a better way to do this as per Matter.js but for now it's a crackpot solution.