PeasyCam on Android

edited January 12 in Android Mode


This is my first time to post, I am not sure if I put this in the right section of the form.

After 1 day of searching, reading, testing, finally, I got the Android mode up and running. I can successfully run some test sketch, most of them works perfect. However, when I try to run sketches with PeasyCam lib, the console is giving me errors, saying \ant\build.xml XXX has errors. I looked the build.xml file, the error lines read like this.

 <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
            <!-- only convert to dalvik bytecode is *not* a library -->
            <do-only-if-not-library elseText="Library project: do not convert bytecode..." >
                <!-- special case for instrumented builds: need to use no-locals and need
                     to pass in the emma jar. -->
                <if condition="${}">
                        <dex-helper nolocals="true">
                                <fileset file="${emma.dir}/emma_device.jar" />
                        <dex-helper />

                <path path="${out.dex.input.absolute.dir}"/>
                <path refid="out.dex.jar.input.ref" />
                <external-libs />

I am using Processing 3.2.3 Android SDK API 7.1.1 (25)

Here is the code I am running into problems when I try to run it on my Android device (physical device);

import peasy.*;
PeasyCam cam;

void setup () {
  size (800, 800, P3D);
  cam = new PeasyCam(this, 200);

void draw () {

Could someone possibily please help?


  • edited January 12


    --not sure at all that peasy is supposed to work in android mode; the doc never says that and looking in the source you can see that some methods or listeners (mouseWheel e.g) probably cannot run;

    --+ trying myself to compile some project with peasy for testing, i see that the error is "unsupported class file version 52.0 [dx] ...while parsing peasy/CameraState.class" this error according to Oracle means incompatibility versions of java (1.7,1.8)::

    The class file version for Java SE 8 is 52.0 as per the JVM Specification. Version 52.0 class files produced by a Java SE 8 compiler cannot be used in earlier releases of Java SE. The following document has information on changes to the Java Language Specification (JLS) and the Java VM Specification (JVMS).

    JSR 337: Java SE 8 Release Contents

    --Then the Android doc adds that "android supports java 1.7 + a subset of 1.8...

  • Hello akenaton

    Thank you for your reply and look into this. I should have thought of this.

    Anyhow, I am working on a 3D app for Android, this is going to be my 1st android app, it is pretty simple and basic.

    Now, since Peasycam can not work in Android mode, I am wondering is there any other ways, better ways to navgiating the view?

    Thank you again.

  • If you draw your objects in draw, you could introduce offsets in their positions simulating camera displacement. You can also try the camera() function. however, I haven't tested it myself in Android yet.


  • edited January 12 Answer ✓

    @Bizkit=== as for android 3D you can use the native android OPENGL ES:

    --there is also the min3D library which is more simple and can be imported in Eclipse or AS, yet probably not as it is in Processing.

  • Here is an example of manipulating the scene by using translate and rotate functions. You can use the ketai library to use other multi-touch events like pinch or flicks. I hope this helps,


    //Move finger along width of device to rotate box
    //Drag finger along height to move object in the Y-Z plane
    //NOTICE mini sphere grid is lay out on the X-Y plane
    PShape b;
    float offset=0;
    boolean pre=false;
    PGraphics pg;
    void setup() {
      size(displayWidth, displayHeight, P3D);
      b = createShape(BOX, 100);
      b.setFill(color(100, 220, 200));
      pg=createGraphics(width, height, P3D);
      for (int i=0; i<width; i+=100)
        for (int j=0; j<height; j+=100) {
          PShape s = createShape(SPHERE, 20);
          pg.shape(s, i, j);
    void draw() {
      image(pg, 0, 0);
      if (pre==true)
      float angle = map(mouseX, 0, width, 0, 360);
      translate(width/2, height/2+offset, offset*2);
      shape(b, 0, 0);
    void mousePressed() {
    void mouseReleased() {
  • You can use the camera handler provided by Processing:

    However, it seems that mouse events don't respond. To demonstrate, replace line 50 in my previous post with:

      camera(width/2.0, height/2.0, (height/2.0) / tan(PI*30.0 / 180.0), 0,0, 0, 0, 1, 0);  


Sign In or Register to comment.