jPCT-AE - a 3d engine for Android > Support
[Tips] Android, augmented reality 3D with JPCT + Camera.
EgonOlsen:
Then just try to apply a rotateX((float)Math.PI) on the matrix (the 90° i wrote in my former post are of course wrong, it has to 180). Or maybe you have to invert it in addition to be useful? Keep in mind that a camera transformation is actually an inverse world transformation. How are you creating the jPCT Matrix? Have you ensured that the result really looks like
/ M[ 0] M[ 1] M[ 2] 0 \
| M[ 4] M[ 5] M[ 6] 0 |
| M[ 8] M[ 9] M[10] 0 |
\ 0 0 0 1 /
?
The place where you set the Matrix shouldn't matter. It's not expensive. Just try to avoid object creation where possible, i.e. don't create a new Matrix each frame if possible.
Darkflame:
Its basically;
--- Code: ---
SensorManager.getRotationMatrix(Rt, I, accels, mags);
Matrix tempR = new Matrix();
tempR.setRow(0, Rt[0], Rt[1], Rt[2],0);
tempR.setRow(1, Rt[3], Rt[4], Rt[5],0);
tempR.setRow(2, Rt[6], Rt[7], Rt[8],0);
tempR.setRow(3, 0, 0, 0,1);
tempR.rotateX((float)Math.PI);
arView.setCameraOrentation(tempR);
--- End code ---
Is this correct?
Rt[] is supposed to be a 3x3 returned by the get RotationMatrix according to google's documentation. (I defined it as Rt[9]).
Something is still very wrong unfortunately. I haven't inverted it yet, but when laid flat on the table using the above code I get this;
The diagonal angle is odd no? (this is basically a simplified version of the demo scene)
[attachment deleted by admin]
dl.zerocool:
--- Quote from: paulscode on May 17, 2010, 01:03:47 am ---
--- Quote from: Darkflame on May 14, 2010, 11:20:30 pm ---I know how to read the sensors and get (rough) angles in the x/y/z from both magnetic and gravitational sensors.
--- End quote ---
Now if only you could get exact GPS coordinates for the phone as well - with that and the angles, you could, for example, place a secret clue somewhere, and create a real-world treasure hunt game that people use their androids to play..
--- End quote ---
Yes that would bee a cool idea :) But another project XD
Darkflame:
Not really, if I can get my system working, Treasure hunts will be possible :)
Darkflame:
Ok, I decided to give this another go, and I'm determined to get it right :)
I'm going to go step by step this time and be as methodical as possible.
I'm currently just bliting a rotation matrix onto the screen.
The source of which is "RT" from;
SensorManager.getRotationMatrix(Rt, I, accels, mags);
Where accels and mags are from the sensors.
Question;
How often should this update? It seems to be far too slow to be any use.
I mean, once every 2-3 seconds it gives a new matrix out, even though its triggered hundreds of times inbetween.
Does anyone successfully use getRotationMatrix from here? What speeds does it update? I'm using a HTC Legend, Android 2.1.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version