1
vote
2answers
49 views

How to create Whirlpool/Vortex effect?

Im trying to make a Vortex effect on a Circle Body that is a Sensor. I've been looking for this and all examples i look for are in C++ or Objective C and i dont seem to translate them well. when my ...
0
votes
0answers
40 views

Libgdx/Box2D PolygonShape has no position… well, what now?

As my prototype works perfectly fine I want to advance to more fun areas of the project and add a more complex player-character body. So for Box2D I figured I'd need multiple fixtures, like one for ...
0
votes
1answer
96 views

Making Player Jump

I have been editing a piece of code and I have already implemented gravity so I would like to know how i could make the player jump when the screen is touched. I would like the player bucket to jump. ...
0
votes
0answers
25 views

[LibGdx]Moving a fixture on a body

I'm working with Box2D and I have a basic platform and a box bounces off of it. // Static Platform bdef.position.set(160 / PPM, 120 / PPM); bdef.type = BodyType.StaticBody; Body b = ...
1
vote
1answer
67 views

Box2DLights - the center of sprites are always 100% unlit (black) unless Xray is on

I'm using a ConeLight at 180 degrees, with this setup: pl = new ConeLight(rayHandler, 256, new Color(0.5f, 0.5f, 0.5f, 1f), 280f, 400 - x, 300 - y, 0, 180); And the object I'm casting a shadow on ...
0
votes
1answer
56 views

Bodies going through the walls of a box

I have a game where the user controls a box to collect falling balls. However, very often the balls will just fall through the walls of the box and be flung away. What could be causing the balls to do ...
0
votes
1answer
42 views

Get position of Fixtures

I'm constructing a Body (a box2d body using AndEngine) using multiple Fixtures and later I need to get the world position of these Fixtures. Currently I am trying something like this; // ...
1
vote
1answer
130 views

LibGDX Box2DLights shadow offset problem on bodies

Hello I just started to use LibGDX, and it's awesome. I looked at the Box2DLights library, and started to learn how the lighting work here. I got something up: As you can see, it works, but the ...
1
vote
0answers
41 views

Box2D random crash when adding joints

I'm currently working on a project which uses Box2D, when the player uses a certain key it should anchor to the ground. For that I use a weld joint, but when I add the joint the game will sometimes ...
0
votes
0answers
51 views

Box2D and randomly generated tilemaps

I am making a 2D Terraria-style sidescrolling game. I want to use box2d for the physics. However, I am using tilemaps for the maps, and I do not know of a processor-efficient way to use Box2D bodies ...
1
vote
1answer
88 views

Libgdx Box2d createfixture crashes vm intermittently

I have a hard to debug problem. I have a Box2D game which creates a wheeled vehicle. I want the vehicle body to reflect when it goes from moving left to moving right. to do this i set a flag in a ...
1
vote
1answer
73 views

Preventing rapid inversions of boolean on Collision detection

I know this is both a strange question and a stupid question. But this is an issue I have dealt with in every single game I've made, and I have yet but to find a solution. I can't be the only one ...
0
votes
1answer
86 views

Player doesn't jumps in Box2D implementation [closed]

Well, i'm trying to learn andEngine. I was able to successfully implement the move functionality for the player. Now, i'm trying to make the player jump using Box2D. I referred few online tutorials to ...
0
votes
0answers
35 views

GWT problem with Box2D WheelJoint

I am using the below libgdx java code for a wheel joint and rear axle using Box2D. This works fine for android, Desktop, but when I attempt to run through GWT I get the following error. at ...
0
votes
0answers
123 views

Box2dLights rendering in bigger scale

So basically my box2dLights are rendering in wreid places. The circle in center is my player and as you can see lamp which should be aligned to player is in the right-top corner. my code: package ...
2
votes
1answer
676 views

Maintaining velocity of free fall body using Box2D in libGDX

I want to maintain the speed of a free-falling Box2D body using LibGDX. I'd like the vertical velocity increase with the level. I've applied a linear impulse and velocity actually increases like this: ...
4
votes
3answers
217 views

How do I change the relative origins of a Box2D World and a TiledMap in Libgdx?

I'm playing around with Box2D and TiledMaps and I've come across this minor annoyance. As you can see, both Box2D and TiledMap render at the center of the screen. This forces me to compensate by ...
0
votes
0answers
38 views

Box2D Joints Disconnect

I'm trying to make a soft body physics system using rigid bodies in a circle. I'm having a problem where my joints only connect to one of the bodies, and seems to disconnect from the others. I think ...
2
votes
2answers
146 views

How do I create a horizontally centered “gravity line”?

Here's my ideal scenario: A game object (in blue) can change its horizontal velocity, but it will be pulled back by gravity (dotted gray arrows) toward a central vertical line (in red). How can I ...
0
votes
0answers
34 views

2D collision beetween a sprite and an array of sprites [duplicate]

I am creating a simple Android jumper (think Doodle Jump or Abduction) using libGDX so I can get started in game programming. My problem is that I need to figure out a way to check for collision ...
1
vote
0answers
63 views

Need to join 2 bodies via weld joint but not on center of mass

I have successfully join 2 bodies via weld joint , but my problem is I want to join corners of bodies not on centre of mass. Is there any way to achieve this? Above image consist 3 polygon body that ...
2
votes
1answer
155 views

JBox2D Polygon Collisions Acting Strange

I have been playing around with JBox2D and Slick2D and made a little demo with a ground object, a box object, and two different polygons. The problem I am facing is that the collision-detection for ...
1
vote
1answer
388 views

Movement of body after applying weld joint

I have two rectangular bodies. I've applied Weldjoint successfully on these bodies. I want to move that joined body by applying linear impulse. After weld joint, these two bodies becomes single body ...
0
votes
1answer
67 views

libgdx fixture is giving unresponsive error

need some support. I am novice in libgdx game engine. Below is my code package com.game.box2d.fruitcart; import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import ...
0
votes
0answers
237 views

Box2D revoluteJoint Motor speed,Max torque scaling for diff Devices

Hi i am using Box2d Revolute Joint as a joint for wheel it's connect to Wheel and Body of my Car i am using RUBE for creating the Box2D world Prob. i am using a scaling floating point number to scale ...
0
votes
1answer
611 views

Movement with box2d using libgdx

I am pretty new to using physics engine and would like to know what is best practice for movement of playercharacters. Currently I have a class called Hero that has a CircleShape and when the user ...
2
votes
0answers
339 views

Choosing a level editor of a 2d platformer [closed]

I'm working with a small team on a 2D platformer game in Java (LibGDX) that uses Box2D for physics. Our team is looking for a tool to make the levels (that we will be able to integrate with the Box2D ...
0
votes
1answer
722 views

Error using Physics Body Editor for LibGDX

In my game, I've been trying to use the physics body editor for libgdx, but I kept on getting an error. So I thought there was probably something wrong with my code so I took the example off of the ...
2
votes
1answer
314 views

Camera scrolling and game boundaries

I am making a platformer game in JBox2D and LWJGL that has a scrolling camera, but I have hit a wall with the boundaries of the camera. Essentially what I have right now is a Box2D world that is ...
2
votes
1answer
271 views

How do I make my camera follow a Box2D object?

I'm implementing a camera in my game. It worked for regular objects, but I began using Box2D and obviously things changed a bit. I have a Body object that I want to draw at the center of the screen. ...
3
votes
1answer
393 views

How to implement server side physics?

I am working on 2-player 2d sidescroller. How should I implement the physics on the server? Use one world for every game or use a big world in which I add every 2 player that start a game? I have ...
0
votes
1answer
312 views

Moving a Box2D object in the direction it is facing using applyForce [duplicate]

I'm trying to apply force to a polygon physics object to move it. Whilst I can get it to move upwards easily enough, I'm trying to get it to move in the direction in which it is pointing. Here's my ...
4
votes
2answers
389 views

2.5d with box2d - approaches from the top and bottom

So, I'm using box2d for my 2.5d game (think double dragon, tmnt arcade, castle crashers) where you can move around on the z-axis (faked as y-axis movement). Basically, I have box2d only doing ...
2
votes
2answers
1k views

How do I get the touch event on a body in Box2d(Java)

I have various bodies rotated at some angle with the help of Box2d in libGDX. What I want is to destroy the body when I click on it, but the problem is that I am not able to get the area definition of ...
1
vote
2answers
2k views

Applying Forces to Box2D Bodies

In full disclosure, I am VERY new to box2D let alone the Java version of it. I have a box (here of type Hero) that I am trying to move. I did this by trying to apply a force as follows... private ...
2
votes
1answer
659 views

Pathfinding and BSP with Box2D

I'm looking into implementing AI in my 2D side-scrolling platformer, and I'm looking into using algorithms such as A*. For many kinds of pathfinding, we need some sort of grid or systems of nodes or ...
3
votes
1answer
2k views

Andengine. Put bullet to pool, when it leaves screen

i'm creating a bullet with physics body. Bullet class (extends Sprite class) has die() method, which unregister physics connector, hide sprite and put it in pool public void die() { ...
4
votes
3answers
558 views

Box2d Collision problem

I'm not good with words so here's a picture to describe my problem: In my game there is this big ball which the user can move on x-axis only. Now, if the ball is falling like the red one, it's ...
0
votes
1answer
416 views

JBox2D - how to get vertex positions?

I've created a triangle for jbox2d... public void createTri(){ PolygonDef shape = new PolygonDef(); shape.density = 2.0f; shape.friction = 0.8f; shape.restitution = 0.3f; ...
3
votes
3answers
587 views

Why does creating dynamic bodies in JBox2D freeze my app?

My game hangs/freezes when I create dynamic bullet objects with Box2D and I don't know why. I am making a game where the main character can shoot bullets by the user tapping on the screen. Each touch ...
1
vote
1answer
2k views

Best way to create a level editor in java [closed]

I am creating an iPhone game using cocos2d + box2d that needs a lot of levels. My friends and I are creating the game and most of them have no programming experience and end up with nothing to do. I ...
1
vote
1answer
546 views

Box2D how to implement a camera?

By now i have this Camera class. package GameObjects; import main.Main; import org.jbox2d.common.Vec2; public class Camera { public int x; public int y; public int sx; public int sy; public ...
1
vote
1answer
594 views

Box2D platformer movement. Should i mess with velocity?

I have a platformer game in which I implemented the movement using a wheel attached to the hero. For jumping I use this: player.body.applyLinearImpulse(new Vec2(0, 30000000), ...
3
votes
1answer
1k views

How do I implement smooth movement in a Box2D platform game?

I have implemented a character in JBox2D which moves with the help of a wheel rotating at the bottom of it. The movement is the best result I've had 'till now but it's a little glitchy when the ...
4
votes
1answer
1k views

Box2D platformer movement. Are joints a good idea?

So i smashed my brains trying to make my character move. As i wanted later in the game to add explosions and bullets it wasn't a good idea to mess with the velocity and the forces/impulses didn't work ...
1
vote
1answer
1k views

JBox2D applyLinearImpulse doesn't work

So i have this line of code: if(input.isKeyDown(Input.KEY_W)&&canJump()) { body.applyLinearImpulse(new Vec2(0, 30), cam.screenToWorld(body.getPosition())); ...
1
vote
1answer
4k views

LibGDX Box2D Body and Sprite AND DebugRenderer out of sync

I am having a couple issues with Box2D bodies. I have a GameObject holding a Sprite and Body. I use a ShapeRenderer to draw an outline of the Body's and Sprite's bounding boxes. I also added a ...
5
votes
1answer
3k views

Box2D Difference Between WorldCenter and Position

So this problem has been brothering for a couple of days now. First off, what is the difference between say Body.getWorldCenter() and Body.getPosition(). I heard that WorldCenter might have to do ...
1
vote
1answer
2k views

How would I use JBox2d in Java?

So I did some research and a found Box2d. I then proceeded to download it and the testbed. Now that i have it, I don't know how to properly use it. I'm looking for a clear simple answer on how to ...
2
votes
1answer
1k views

How to setup JBox2D

I resently downloaded the JBox2D but how do I set this up?.. Its jbox2d-2.1.2.2 All I can see is a bunch of code and folders. Any websites with step by step tutorial?? You know how??