p5.EasyCam
p5.EasyCam copied to clipboard
EasyCam not working for p5.js 0.9.0!
I have tried to use EasyCam but the canvas doesn't show when I use easycam
Here is my code:
var easycam;
function setup() {
createCanvas(400, 400, WEBGL);
easycam = createEasyCam();
}
function draw() {
background(0);
lights();
box(100);
}
Here is screenshot:
Two things to make EasyCam work with 0.9.0:
- Be sure to include in the index file:
- Insert the following before the call to createEasyCam(): // fix for EasyCam to work with p5 v0.9.0 Dw.EasyCam.prototype.apply = function(n) { var o = this.cam; n = n || o.renderer, n && (this.camEYE = this.getPosition(this.camEYE), this.camLAT = this.getCenter(this.camLAT), this.camRUP = this.getUpVector(this.camRUP), n._curCamera.camera(this.camEYE[0], this.camEYE[1], this.camEYE[2], this.camLAT[0], this.camLAT[1], this.camLAT[2], this.camRUP[0], this.camRUP[1], this.camRUP[2])) }; Example: https://editor.p5js.org/jwdunn1/sketches/1J8asex6f See also issue 5.
@jwdunn1 Thank you for the answer. It works in an online editor with the example you gave and also locally on my laptop, however, when uploaded the sketch to my website, the EasyCam does not work. Do you know what it could be? Regards_