www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: gamenewer on January 06, 2015, 11:41:48 am
-
Hello , I use a picture to show my question. I use framebuffer.blit to show a far scene in my game, as red part in picture, the far scene position at the road end ( maybe not the end , as far as see ,hope you can see my mean). My question is : How to caculate the Y position?(as blue line show in picture), Thanks ! :)
-
http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Interact2D.html (http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Interact2D.html) has some methods to do such things. In your case, you might want to look at the project3D2D-methods.
-
Thank you Egon, I try use this method :project3D2D(Camera camera, FrameBuffer buffer, SimpleVector vertex), I only know the y=0 of the vertex parameter, becuse the road place on the groud( y = 0), I have no idea how to set the parameter vertex. Could you help me ? Thanks !
-
Any one help me? thanks ;)
-
You need some vertex at the end of the road. Either take it from the mesh or create it out of the data that http://www.jpct.net/doc/com/threed/jpct/Mesh.html#getBoundingBox() (http://www.jpct.net/doc/com/threed/jpct/Mesh.html#getBoundingBox()) returns.
-
Oh , thanks , The road is closed, the view position changed every frame, should I create vertex every frame?
-
Is that needed? The actual screen position of the end doesn't really change, or does it?
-
I show a picture, fisrt at point 1 , the end at the end_1 , if at the point 2 , the end at the end_2 .Yes, the actual screen position of the end doesn't really change, but I don't know how to get the correct vertex .
-
Either choose a pragmatic solution and create a backdrop image that will still look good when there's a small gap between the road and the city scene or you could simply iterate once over all vertices after setting up the scene and the camera, project everything into 2D and choose the max y value of all.
-
A backdrop image may be a simple solution, i will try ajust y position for diffrent device screen size