Using the PMatrix3D class in Android Studio


#1

I’m developing a game for Android, it’s a 3D platform where you move a ball depending on the position of the phone. Everything is set up for the development, I have the processing core jar dependency included, it’s not the first time that I work with Processing in Android Studio.

However, it’s the first time that I use the 3D The problem is that when I call functions like rotateX() or rotateY(), Android Studio tells me that he cannot find the method, even when the package is imported. I get the error "Cannot resolve method ‘…’ "

If someone already faced that issue, let me know. I’ll look for solutions on my side.


#2

Promblem solved!

I’m working on multiple classes on this project, so I created separated classes and I imported the libs on top of each of them. I found out that importing the classes in a class that is not a processing Sketch will not work.

In order to make it all work, I created the class within the Sketch class, and it works perfectly.

I hope this will help someone in the future.


#3

Hi, thanks so much for posting your question, and the solution your found eventually!

Regarding the imports in Android Studio, yes, you need to add them explicitly. When running your sketches from the PDE, there is no need for that since the Processing preprocessing adds all the required imports. You could also do import processing.core.*; to import all core classes into your code.