Author Topic: Placing objects in the world  (Read 2040 times)

Offline jkndmiththinda

  • byte
  • *
  • Posts: 4
    • View Profile
Placing objects in the world
« on: March 07, 2012, 08:26:20 pm »
Hi I'm new to JPCT engine and find it great and very interesting. I need to create a screen with 3d icons and text captions and i want these icons to be spread evenly on the screen, regardless the screen size of the device. I used blitting to position the captions as desired. But i have trouble positioning the corresponding 3d icons, I don't understand how to correlate screen size with the object translation units. Could you please explain how to do this? Once again, thank you very much for sharing this great engine!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Placing objects in the world
« Reply #1 on: March 07, 2012, 08:39:49 pm »
It's a basic perspective projection, but there's no rule that says "50 units in world space to the left ends up at pixel 50/60 on a 800*480 display. It depends on a lot of things like fov, camera position, scale etc.

However, maybe this method can help to find a solution: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Interact2D.html#reproject2D3DWS(com.threed.jpct.Camera, com.threed.jpct.FrameBuffer, int, int)

Offline jkndmiththinda

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Placing objects in the world
« Reply #2 on: March 08, 2012, 07:56:56 pm »
Dear EgonOslen,

Thank you very much for the reply. I managed to get the task done using the reference you gave. Again, thanks for sharing this great engine with the developer community.