LibGDX - Camera Coordinate To Screen Coordinate?

Hi,

I made a sprite, that is moving on the screen. The sprite moves from left screen to the right screen.

Now, I will hide the sprite and I will add a 3d Object on the sprites position.

The problem is now: The width and height of the screen is 800x480.

And now I don’t know how to move the 3d object? e.g.

Gdx.gl10.glTranslatef(sprite.x, srite.y, -35.0f);

Must I now cam.project or cam.unproject this? Or what is the right keyword?

Your question is confusing but I think I understand the gist of it. Does LibGDX even have support for 3D? Why is the screen size a problem? I think you’re trying to figure out how to convert your 2D world into 3D when you place the object right? In that case, you’ll need

gluPerspective ()

If you could be more specific in your question, I could help more, though.

I added the perspective camera like this:

		camera = new PerspectiveCamera(67, VIRTUAL_WIDTH, VIRTUAL_HEIGHT);

gluPerspective is the same, right?

OK. I try to explain. e.g.

The sprite is moving from left to right. When I now

System.out.println(sprite.x+" | "+sprite.y) 

I get this e.g. x:50, y:100 or x:55, y100 or x:500, y:100 etc.
The (0,0) is left bottom!

Now I don’t know how move the 3d object at this positions? This is not working:

Gdx.gl10.glTranslatef(sprite.x, srite.y, -35.0f);

For e.g. When I do this,

Gdx.gl10.glTranslatef(100f, 0.0f, -35.0f);

I don’t see the 3d object on the screen: