Hi! I’m coding some projections that need to be switched between using keypresses. Each projection is its own class and one of them, “Stars”, which just displays a bunch of stars, is 3d. I’m using peasycam for this, but I keep getting this error: ‘The constructor “PeasyCam(Stars,int)” does not exist’ on my line that says cam = new PeasyCam(this, 100);
Could someone tell me why this is happening and how to fix it?
Any help would be greatly appreciated!!
here is the full code for the class:
public class Stars extends Scene
{
ArrayList<Star> stars;
float b = 0;
boolean fade;
int x;
import peasy.*;
PeasyCam cam;
void initialize() {
stars = new ArrayList <Star>();
// size(600,600,P3D);
fullScreen(P3D);
cam = new PeasyCam(this, 100);
cam.setMinimumDistance(50);
cam.setMaximumDistance(500);
for (int i = 0; i < 80; i++)
{
Star s = new Star();
stars.add(s);
}
}
void display()
{
background(b);
for(Star s : stars)
s.display();
if (fade)
fade();
x ++;
camera (x, height/2, (height/2)/tan(PI/6), x, height/2, 0,0,1,0);
}
class Star
{
float x = random(-2000, 2000);
float y = random(-2000, 2000);
float z = random(-2000,2000);
/*Star()
{
}
*/
void display()
{
pushMatrix();
noStroke();
fill(255);
translate(x,y,z);
sphere(5);
popMatrix();
}
}
void fade()
{
if (b < 255)
b += 1;
for (int i = stars.size()-1; i > 0; i --)
{
Star s = stars.get(i);
stars.remove(s);
}
}
void keyPressed()
{
if (key == ' ')
{
fade = true;
}
}
}