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.
import processing.ar.*;
import com.google.ar.core.*;
void setup() {
fullScreen(AR);
}
void draw() {
lights();
ARSurface surface = (ARSurface) getSurface();
Pose p = surface.camera.getPose();
float tx = p.tx();
float ty = p.ty();
float tz = p.tz();
if (mousePressed) {
println(tx + "/" + ty + "/" + tz);
}
stroke(204, 102, 0);
strokeWeight(10);
pushMatrix();
translate(0,0,-1);
rotateY(ty*3);
fill(0,0,200);
box(0.1);
popMatrix();
pushMatrix();
translate(tx,ty,tz-1);
fill(0,200,200);
box(0.1);
popMatrix();
line(0,0,-1,0,0.3,-1);
line(0,0,-1,tx,ty,tz-1);
line(tx,ty+0.3,tz-1,tx,ty,tz-1);
line(tx,ty+0.3,tz-1,0,0.3,-1);
}
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!