Author Topic: in racing game how to creat a minimap?  (Read 2698 times)

Offline Uncle Ray

  • int
  • **
  • Posts: 81
    • View Profile
in racing game how to creat a minimap?
« on: September 18, 2014, 05:44:21 am »
    SOLVED THX EGO                                                                                                         ________________
                                                                                                             |    ___________   |
                                                                                                             |    ____●___     |  |
                                                                                                             |                  |    |  |→→→→→→→→→minimap
                                                                                                             |                  | ● |  |
_______________________________                                                     |__________|__|_|
                                                       |
                  npc_car ← ■                   |
______________________               |
                                       |  my_car  |
                                       |    ↑ ■       |→→→→→→→→→→→→my_main_world(which place the Object3D)
                                       |               |
                                       |               |



                                                                                                                           _____________________________________________________________________________________________________________

In the unity 3d ,if you want to create a minimap just set second camera,and...............

but in the jpct,how?
And i want to show whole of  the trace in the minimap,and just the location of the my_car and npc_car but not rotation,because in my game cars always forward.

i have the model of trace,how to reach that?
Anymore help would much appreciated.

« Last Edit: October 20, 2014, 02:54:28 pm by Uncle Ray »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: in racing game how to creat a minimap?
« Reply #1 on: September 18, 2014, 08:18:12 pm »
It's basically the same thing as in Unity: Render the scene with a different camera. You can swap cameras in the world instance. In your case, it seems reasonable to render the scene in bird's view once into a texture and blit the result into the map view. The position of the cars can then be calculated based on the texture's size then their position in world space. Just make sure to enable OpenGL ES 2.0 or otherwise, render to texture won't work reliable on some devices.

Offline Uncle Ray

  • int
  • **
  • Posts: 81
    • View Profile
Re: in racing game how to creat a minimap?
« Reply #2 on: September 19, 2014, 03:56:49 am »
My question was solved ,thx ego.

But there is a new question:
when i use buffer.blit(texture, 0, 0,1256+225-(mycar_dx), 8+220+(mycar_dz), 32, 32, FrameBuffer.TRANSPARENT_BLITTING);
in device which is 1920*1080,it is ok,just in the right location.
in device which is 1280*720,it's dispear......
when i switch LANDSCAPE to PORTRAIT,it's dispear too.


I think the problem is locate the minimap was based on the pixel,is that right?
Is there a method of blit() which is not base location on pixel but base on the proportion of device's screen(1080p,720p,480P)

thanks

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: in racing game how to creat a minimap?
« Reply #3 on: September 19, 2014, 09:38:39 am »
No, there isn't. But you do this pretty easily by yourself by taking the actual screen resolution into account. I tend to wrap such blits in a some helper methods that either take normalized coordinates or work with a virtual resolution like 800*480 and maps that to the actual coordinates. Just keep in mind that as aspect ratios differ between devices as well.