Tagged Questions
2
votes
2answers
274 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 ...
0
votes
2answers
251 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
387 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 ...
2
votes
1answer
645 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
438 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
249 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
385 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
1k views
Best way to create a level editor in java
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
446 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
420 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
766 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 ...
1
vote
1answer
920 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 ...
0
votes
1answer
503 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()));
...
0
votes
0answers
2k 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
1k 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 ...