Tag Info

New answers tagged


a box2d rectangle has x and y coordinates with thw center in the center of rectangle... other this, to create a rectangle pay attention to give him halfWidth and halfHeight and not full. for example, if you want a 2*2 rectangle in left down corner you have to build it with: x = x+halfWidth y = y+halfHeight halfHeight =1 halfWidth =1


You need to know the pose of Entity A in the global space (x1,y1,θ), where θ is the orientation relative to the x axis. To convert the EntityB location from a global coordinate (x2,y2) to a local coordinate (x2',y2'): Using expressions Global to Local x2' = (x2-x1)cosθ + (y2-y1)sinθ y2' = -(x2-x1)sinθ + (y2-y1)cosθ Local to Global x2 = x2'cosθ - ...


polar to cartesian in 3d (spherical coordinate system) x = r * sin(theta) * cos(phi) y = r * sin(theta) * sin(phi) z = r * cos(theta) where theta and phi are your x , y angles


Use camera projection instead of the viewport projection. And use the cameras viewport instead of your virtual viewport. The stuff on your screen is rendered using the cameras projection and the cameras viewport, so if you want world coordinates to end up in the same place, then this should solve your problem: cam.project(new Vector2(gameX, gameY), 0, 0, ...


I finally managed to solve my own question, by doing some simple linear algebra. In case anyone is curious, Here is how I solved my problem: Here is the drawing code: public void drawZigZag(Graphics g) { int offset = 0; for(int x = 0; x < mapWidth; x++) { if(x % 2 == 1) { offset = tileWidthHalf; } ...

Top 50 recent answers are included