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.


Messages - moyosa

Pages: [1]
1
Support / Animated textures for planes...
« on: July 17, 2015, 09:08:33 am »
Hey I need some help with animated textures. I'm looking for some example code.

I dont know where to start.

Thank you so much.

2
Support / Rotate camera with current up axis
« on: January 20, 2015, 11:19:18 pm »
Here's one of my crazy examples/problems

When my camera is horizontal this works just fine.
cam.rotateCameraY((float) Math.toRadians((double) rotY));

But with my gyroscope I'm changing the camera rotation. So I probably need the current up axis.

So I've tried this. cam.rotateCameraAxis(cam.getUpVector(), (float) Math.toRadians((double) rotY));

But thats not giving me the right results...

Thanks.

3
Probably some unnecessary steps, but gives me the result I need :)
 
Matrix temp;
                    temp = world.getCamera().getProjectionMatrix(touchfb).cloneMatrix();
                    temp.transformToGL();
                    float [] projection = temp.getDump();
                    temp =world.getCamera().getBack().cloneMatrix();
                    temp.transformToGL();
                    float [] modelView = temp.getDump();
                    GLU.gluUnProject(mPreviousX2, viewport[3]-mPreviousY2, 1, modelView, 0, projection, 0, viewport, 0, startcoords, 0);
                    GLU.gluUnProject(me.getX(), viewport[3]-me.getY(), 1, modelView, 0, projection, 0,viewport, 0, currentcoords, 0);

4
Haha yeah sorry, will do. Just wondering is there a way to use gluUnProject

All I need is the modelview and projection.

5
Now that seems to be working, But I have like a stereoscopic view, and using new FrameBuffer(width/2, height); with first com.threed.jpct.Config.viewportOffsetX = 0.0f; and then com.threed.jpct.Config.viewportOffsetX = 1.0f;

So I can draw the same scene but using a left and right eye.

For example in portrait, left en right is working fine, but in landscape it only calculates on the right view, so when I move over the left eye the offset seems to be slowing down.

SimpleVector startLocation = new SimpleVector(Interact2D.reproject2D3DWS(world.getCamera(), fb, (int) mPreviousX2, (int) mPreviousY2, 10.f));
                    SimpleVector currentLocation = new SimpleVector(Interact2D.reproject2D3DWS(world.getCamera(), fb, (int) me.getX(), (int) me.getY(), 10.f));

I've tried using fb = new FrameBuffer(width, height); for the full use of the view. But it doesn't seem to work.

6
Support / Move camera left/right on x-axis of the rotation
« on: January 15, 2015, 03:27:23 pm »
Hi,

I've got a camera and it has it's own rotation I set in the setBack. Now I want the translate let's say 10 px to the left en my camera is tilted. it does not seem to go left in the rotation x-axis but just the normal work x-axis.



So when I do a setPosition of (10,0,0). it exactly does that. But how doI translate of the rotation x-axis?



7
My activity/view is locked to landscape. My gyroscope controls the camera. So it's like a viewport. when you move your device around you, you can look around the 3dworld.

But I want to be able to also control the camera with touch so I need an offset. Normally you can use the x and y of the touch point. But because you can also rotate the device to portrait for example, you cannot rely on the x-y touch point. So I need to unproject the 2 d coordinates to 3d, to give me the the right x and y in the view and not the ones of the real world.

Hope that makes more sense?

Thanks!

8
Yes I did, and they remain as if in the same orientation landscape. Because i locked it in landscape.

But my camera is always leveled horizontally. So when I go from landscape to portrait my camera adjusts it's never tilted or upside down.

1 would expect that unprojecting the coordinates it would give me different results.?


9
I'm building a 360 camera in a 3d world. Now the gyroscope is updating the camera, so it's like an AR kind of camera.

Now I want to set an offset on the x and y axis. When I start the 3d world in landscape. For example left and right is working.
But when I rotate the device to portrait, x and y should be reversed. But reproject2D3D is still giving me the same results.
So now to scroll left and right, you need to scroll up and down (makes sense?)

Seems like unproject/reproject is not working for me here.

Code: [Select]
SimpleVector startLocation = new SimpleVector(Interact2D.reproject2D3D(world.getCamera(), fb, (int)mPreviousX2, (int) mPreviousY2)).normalize();
                SimpleVector currentLocation = new SimpleVector(Interact2D.reproject2D3D(world.getCamera(), fb, (int) me.getX(), (int) me.getY())).normalize();

double alpha = Math.acos(currentLocation.y) - Math.acos(startLocation.y);
double beta = Math.atan2(currentLocation.z, currentLocation.x) - Math.atan2(startLocation.z, startLocation.x);


double tRotX = rotX - MathUtil.toDegrees((float)beta);
rotX = tRotX%360;

PS I've got this working in iOS, so should be good.

Pages: [1]