Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Marc

#1
Support / Re: Little problem regarding MergeAll
March 06, 2012, 03:48:37 PM
Sorry for the inconvenience. It seems as I looked at the wrong thing. It was a very silly mistake like I thought. rotateX nfrom Object3D works with RAD angles, not with degree. I simply ignored the places, where I used it.

Thank you for your time.

Marc
#2
Support / Re: Little problem regarding MergeAll
March 06, 2012, 12:39:06 PM
I was checking that with the dot product. It's always 0, so they are perpendicular.
#3
Support / Re: Little problem regarding MergeAll
March 06, 2012, 12:27:51 PM
udp is just a little UDP Client which I use to get the tracking data from a server. I just parses the 3 Vectors needed from a UDP Packet.
#4
Support / Re: Little problem regarding MergeAll
March 05, 2012, 06:30:52 PM
Thank you for your quick reply. Moving it after the build funktion crashed my program somehow, but now it's working with that implementation. But sadly it didn't solve my real problem.

I have an object standing on (0,0,0) and the camera moving freely. I track the position and the 3 directional Vectors of the pad and give it to the Activity to change the Camera in the world space. but now here's the problem. When the camera stands in front of the Object everythings fine. But when I move behind the object the object is linearly tilted till it reaches 45°. I have no clue, why. Some Numbers:

Object (0,0,0)
Camera Pos: (0,0,-2) Direction (0,0,1) Up (0,-1,0) // Everything is fine
Camera Pos: (0,0,2) Direction (0,0,-1) Up (0,-1,0) // The object is 45° tilted

When I stand at the side of the object it is slightly tilted.~22.5°

The Numbers I get from the tracker are all accurate. It seems like the worldspace is bent. Do you have any instant idea, what the matter is?  Here is the onDrawFrame method:
       
public void onDrawFrame(GL10 gl) {
            udp.needData=true;

            Camera cam= world.getCamera();

            SimpleVector[] sv=udp.getLast(); //Getting the camera tracking through a threaded udp Client

            cam.setOrientation(sv[1], sv[2]);
            cam.setPosition(sv[0]);
            sun.setPosition(sv[0]);
            fb.clear(back);
            world.renderScene(fb);
            world.draw(fb);
            fb.display();

            if (System.currentTimeMillis() - time >= 1000) {
                Logger.log(fps + "fps");
                fps = 0;
                time = System.currentTimeMillis();
            }
            fps++;
        }


I could make a workaround tilting the scene against the "natural" tilting. But I would like to know, why it is that way. If you need more code, just tell me. :-)

Thank you in advance,
Marc
 
#5
Support / Little problem regarding MergeAll
March 05, 2012, 12:43:56 PM
Hi everyone,

I'm quite new to jpct and currently trying to do a little AR Application for Android to run on my Tablet.

Now I have a little problem where I just can't get my head around. I'm calling Object3D.mergeAll on a 3ds File. But when I add it to the world I have, it just is at a fixed place, where I can't move it. I just want it on (0,0,0) but cube.setCenter() doesn't work and even something direct like                 
cube.translate(new SimpleVector(-cube.getTransformedCenter().x, -cube.getTransformedCenter().y, -cube.getTransformedCenter().z));
doesn't.

before I was using a Simple Loop over the Object3D array the Loader gave me, added everything to the world and added everything as a child of the array[0]. That work in a way, but then I had other problems.

Here are the codesnippets which are relevant imho.


                try{
                     InputStream f =    getResources().openRawResource(R.raw.liberty);
                     cube = Object3D.mergeAll(Loader.load3DS(f, 1));
                } catch (Exception e){
                    cube = Primitives.getCube(10);
                    Logger.log(e);
                }
                cube.rotateX(-90);
//                cube.translate(new SimpleVector(-cube.getTransformedCenter().x,-cube.getTransformedCenter().y,-cube.getTransformedCenter().z));
                cube.setCenter(new SimpleVector(0,0,0));
                cube.scale(0.02f);
                cube.build();
                world.addObject(cube);


The Position where it lands in the world depends on the 3ds File.

Probably it's just a simple mistake by me.

Thanks in advance,
Marc