Skip to content
Advertisement

Tag: p5.js

P5.js camera not working with multiple rotation matrices

I’ve been working for some time on making a 3D first person camera in p5.js for games and random projects, but I’ve been having some trouble. For some time now I’ve been using a single y-rotation matrix with my projects to allow the player to look around, but I’ve felt like having an upgrade recently, so I decided to use

How can I change the angle of a vector when hitting an obstacle

So, my issue concerns vectors, I don’t know where I’m going with that case. I’m building a pandemic simulation (using Javascript and the library p5.js), and I’m trying to add a lockdown feature. Here is an image to make everything clearer: Essentially, at the moment, when two molecules collide, their velocity vector change appropriately by switching their former velocity. My

How can I use p5.js without it polluting the global scope?

I’m trying to convert some code I wrote for processing.js to use p5.js. In the existing code, I create an object with a statement like processing = new Processing(canvas, p => (p.draw = draw_frame)) with the canvas defined in HTML as <canvas id=”canvas”></canvas>, and any Processing functions and properties are attached to the processing object. For example, to draw a

Redraw Canvas via p5 with deleting the old canvas

I want to visualize my sorting algorithms and redraw the created Canvas each time. My Old Canvas keeps all the old values. It just creates a new Canvas and puts it above the old Canvas. But I thought with the redraw I could solve it. I also tried to delete the canvas via canvas.remove() and create a completly new one

Multiple p5.js Canvases in the same page [duplicate]

This question already has answers here: Can I create multiple canvas elements on same page using p5js (2 answers) Closed last month. although I have some experience with processing, I am new to p5.js. For an academic work, I want to create a website with multiple interactive experiences. I want this website to be one single page, no links no

Advertisement