Questions tagged [box2d]

Box2D is a free open source 2-dimensional physics simulator engine written in C++ by Erin Catto and published under the zlib license

Box2D is a free open source 2-dimensional physics simulator engine written in C++ by Erin Catto and published under the zlib license.

The engine performs constrained rigid body simulation. It can simulate bodies composed of convex polygons, circles, and edge shapes. Bodies are joined together with joints and acted upon by forces. The engine also applies gravity, friction, and restitution.

Ports of Box2D exist for Java, ActionScript, C#, JavaScript, and D.

3289 questions
1
vote
0 answers

Increasing impulse on collision in box2d

I'm creating box2d game and trouble is as follows: Two fighters located on arena, top view. Fighters has weapons like sword in theis hands. I want to fighter bounces in hit direction when damaged by opponent, but fighters has same physical…
michael
  • 11
  • 2
1
vote
2 answers

How do I get the gravity when the screen is titled (Box2D/AndEngine)?

I'm using AndEngine and Box2d to develop a game. I'm applying a force to a body to keep it "aloft" equal to that of gravity. I have the scene set up so that: public void onAccelerationChanged(final AccelerationData pAccelerationData) { …
rphello101
  • 1,671
  • 5
  • 31
  • 59
1
vote
2 answers

Box2D Having gravity affect different masses

If I give bodies different densities/mass, they still fall with the same speed. I know about the fact that in a place without air-resistance, mass doesn't affect falling speed. But then, how do I logically make, let's say a balloon and a brick,…
user717572
  • 3,626
  • 7
  • 35
  • 60
1
vote
1 answer

Need real world example of using collision filtering in box2dweb

I am developing a platform game in boxbox, a wrapper of box2dweb. I want to avoid certain entities not to collide, i.e they can pass through each other. Can anyone provide the real world simpler example of using collision filtering in box2dweb or…
1
vote
0 answers

Box2d - b2EdgeShape & b2ChainShape Depreciated. Now What?

Googling all day could not give me this answer. I have to make an irregular terrain by using b2EdgeShape OR b2ChainShape as it is explained in the box2d manual which is not updated yet because these entities does not exists anymore in the box2d…
n.by.n
  • 2,458
  • 22
  • 31
1
vote
0 answers

How to manually define vertices in box2D javascript?

I am trying to manually define the vertices of a polygon in box2D for javascript. I ultimately want to resize each side of a box manually, but I need to be able to draw it with vertices first (I already have a resizing mechanism). I've looked at the…
Nick
  • 11
  • 1
1
vote
1 answer

How to set multiple convex polygons to a shape in Box2d?

I am new to Box2d, and I have just learned that it does not support concave polygons. I have read to get around this problem, I should use 2 (or more) convex polygons and apply them to the same shape. Unfortunately, I have looked for a hours for an…
jvnbt
  • 2,465
  • 4
  • 20
  • 23
1
vote
1 answer

Getting a b2Fixture of a b2body Box2d?

I have around 10 bodies in my Box2D sample app which i have created with the help of following method. But in my Update method i want get the b2FixtureDef of the bodies because i need there filter.groupIndex which is different for every body. I have…
hemant
  • 1,771
  • 4
  • 31
  • 43
1
vote
2 answers

Collision detection In Andengine

I wanna get collision detection between AnimatedSprite which is Body of box2d and Shape.I'm using codes below.But it gives error. "walls" is a rectangle shape, "player" is animatedsprite. scene.registerUpdateHandler(new IUpdateHandler() { …
user1391058
  • 265
  • 4
  • 19
1
vote
0 answers

create joint to fix body to another body with box2d

I want to create a catapult fixed to the ground beacause i will rotate it later using mouse joint this is my code to fix catapult_arm to the ground { var revJointDef = new Box2D.Dynamics.Joints.b2RevoluteJointDef; …
Mohamed Omezzine
  • 1,074
  • 3
  • 15
  • 28
1
vote
4 answers

Move b2Body to location

Essentially I'm building an app with "tap" controls to control a character in a side scrolling view, the user taps where they want to move the character then the character should move to that x location. I'm just thinking about the best way of…
IApp
  • 667
  • 1
  • 6
  • 18
1
vote
1 answer

Box2d body movement in Andengine

I made a race game.there are car.it is moving by onAnalogScreenContol button.And it's moving perfect what i set velocity to its body.But when i add 50 walls which are Shape of rectangle and body,the car moving very very fast.How can I solve this…
user1391058
  • 265
  • 4
  • 19
1
vote
1 answer

Box2D: edge shape and chain shape use different coordinates for vertices

I'm creating a body with many vertices to collide with another bodies in the scene. This is done with b2ChainShape, but I first tried creating a single edge of that chain (v2v is the coordinates conversion method): b2Vec2 v1 = [U v2v:CGPointMake(0,…
Sergey Mikhanov
  • 8,880
  • 9
  • 44
  • 54
1
vote
0 answers

Shooting a bullet from wrong starting point

I created a racing game in andengine.There is a player which is size 100x30px,like a rectangle.And there is fire() function to shoot bullet, code is below.It works fine.but problem is when player is rotating.player is a car image.so they rotating by…
user1391058
  • 265
  • 4
  • 19
1
vote
0 answers

In Andengine making physics body sporting multi-resolution

I am facing a strange kind of problem while making a physics body in andengineBox2d. I have made all the game using 800x480 resolution and scaling all the graphics using a function to support all resolutions. So when I run the game in 320x480…
Usman Iftakhar
  • 278
  • 5
  • 17
1 2 3
99
100