Tagged Questions
0
votes
0answers
13 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
32 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
38 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
31 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
43 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
56 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
72 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
78 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
32 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
90 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
449 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:
...
2
votes
3answers
119 views
(LibGDX) Changing Origin of Box2D World relative to TiledMap (or Vice Versa)
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
31 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
143 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
62 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
0answers
136 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
328 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
58 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
208 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
452 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
303 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
644 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
280 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
256 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
335 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
261 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
354 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
940 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
1k 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
638 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
1k 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
552 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
404 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
562 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
539 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
582 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
972 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
980 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??
11
votes
1answer
2k views
Should I write my own physics engine, because of networking integration?
I'm currently developing a top down, realtime, zombie shooter. I'm coding this in Java, using JBox2D as my physics engine. I have been coding the networking this week, and am now up to the physics ...
0
votes
2answers
1k views
How to use the box2d contact listener in android (java port)?
I don't have any idea about the box2d collision detection in android. I googled and got results that suggest to use the contact listener but I don't know how to use it in android java.
1
vote
1answer
485 views
How do I calculate logical velocity / direction?
I have a simple jBox2D (Java) implementation of a world with couple of Circle bodies that at the begining are static.
I want to make them movable when the user touches the circle. But I want them to ...
1
vote
1answer
513 views
How to create a vertex array from any shape in JBox2D?
I have a code, that add a vertex array to a shape, my code is:
PolygonDef shape = new PolygonDef();
for (int i=0; i<vertices.size(); i++) {
Vec2 v = vertices.get(i);
shape.addVertex(new ...
3
votes
1answer
817 views
Get shape of my bodies using Box2D
I would like to get the shapes of my bodies, but I can't get anything, only null. Why?
Here is the relevant code section:
Body b;
while((b = box2d.physics.PhysicsWorld.world.getBodyList().getNext()) ...