Hi there,
i am working with Processing for Android for a AR App and I am trying to work with the camera position (e.g. to rotate things according to camera rotation etc.)
I used the commented out lines in the “Cubes” Example:
ARSurface surface = (ARSurface) getSurface();
println(surface.camera.getPose());
And thats what was printed:
t:[x:-0.397, y:-0.184, z:0.087], q:[x:0.56, y:0.44, z:0.43, w:-0.56]
thanks for your reply! As this is clear for you and not for me, I guess I cannot read the Reference of Pose properly, because I am not familiar enough with Java to transfer this information into my project. I see that there are functions on how to get e.g. the tx of the Pose, but I cannot apply them. Whenever I try to declare a new Pose I get "The class “Pose” doesn’t exist. Can you help me how to implement that? I just want to get e.g. the tx as a float.
My sketch is as simple as that now:
import processing.ar.*;
void setup() {
fullScreen(AR);
}
void draw() {
// The AR Core session, frame and camera can be accessed through Processing's surface object
// to obtain the full information about the AR scene:
// ARSurface surface = (ARSurface) getSurface();
// surface.camera.getPose();
// surface.frame.getLightEstimate();
lights();
ARSurface surface = (ARSurface) getSurface();
if (mousePressed) {
println(surface.camera.getPose());
}
}
import processing.ar.*;
void setup() {
fullScreen(AR);
}
void draw() {
// The AR Core session, frame and camera can be accessed through Processing's surface object
// to obtain the full information about the AR scene:
// ARSurface surface = (ARSurface) getSurface();
// surface.camera.getPose();
// surface.frame.getLightEstimate();
lights();
ARSurface surface = (ARSurface) getSurface();
if (mousePressed) {
float tx = surface.camera.getPose().tx();
println(tx);
}
}
import processing.ar.*;
import com.google.ar.core.*;
void setup() {
fullScreen(AR);
}
void draw() {
// The AR Core session, frame and camera can be accessed through Processing's surface object
// to obtain the full information about the AR scene:
// ARSurface surface = (ARSurface) getSurface();
// surface.camera.getPose();
// surface.frame.getLightEstimate();
lights();
ARSurface surface = (ARSurface) getSurface();
if (mousePressed) {
// ie.
Pose p = surface.camera.getPose();
float tx = p.tx();
float ty = p.ty();
float tz = p.tz();
println(tx + "/" + ty + "/" + tz);
}
}
Perfect thanks a lot! Thats what I was looking for. I didn’t know you could use it like this. Now theres a lot more possibilities to play around with fixed objects related to world coordinates and those related to the movement!
This is a test sketch to with a fixed box that rotates depending on ty and another box that moves with the transition of the phone.
Next step would be to have a box fixed to the view thats always 1 meter in front of the camera. I guess the use of the quaternions might be a problem here. Or is there a function which is doing that more simple?
Anyway thats something for later. Thanks again!