Box2D is an open-source rigid-body 2D physics simulation library for games, written in C++.

learn more… | top users | synonyms

0
votes
1answer
144 views

Basic Use of ApplyImpulse

I am trying to apply a force to a bunch of b2_dynamicBodys, but it seems to only work for a random number of items and then stops with an error. //create some items to move bodyDef.type = ...
1
vote
1answer
362 views

AndEngine Box2d game

I'm developing a 2d survival shooter using Box2d extension and I've got some questions: I have two AnalogOnScreenControls. Their listeners modify both sprites and bodies. I receive TouchEventPool ...
-1
votes
1answer
520 views

Attach my sprite with Box2d [closed]

I'm coding Javascript(HTML5) with Box2D. And I want to ask how to attach Sprite with Box2D. This is function My sprite: function My_Sprite() { this.m_Image = new Image(); this.m_Position = ...
2
votes
1answer
2k views

Specifying force and angle in ApplyImpulse in box2d

I need to apply an impulse on a object with a particular force and at a particular angle in Box2d. If I am right the syntax would be the following: body.GetBody().ApplyImpulse(new ...
2
votes
1answer
622 views

What's the best way to handle slopes for a platfomer game using Box2D

I would like to know if there is any known solution for handling the player's movement on slopes using Box2D engine. I tried to do it using a circle as the player. Everything was fine until I tried ...
2
votes
1answer
669 views

Directional Lights

I'm working on a game idea (2D) that needs directional lights. Basically I want to add light sources that can be moved and the light rays interact with the other bodies on the scene. What I'm doing ...
5
votes
2answers
2k views

How to create an extensible rope in Box2D?

Let's say I'm trying to create a ninja lowering himself down a rope, or pulling himself back up, all whilst he might be swinging from side to side or hit by objects. Basically like ...
0
votes
1answer
251 views

Box2dWeb positioning relative to HTML5 Canvas

I'm new with HTML5 canvas and Box2DWeb and I'm trying to make an Asteroids game. So far I think I'm doing okay, but one thing I'm struggling to comprehend is how positioning works in relation to the ...
1
vote
1answer
91 views

Counting no.of bodies present in certain area in box2d?

I am stuck on it:how can i count or find the no.of bodies present in any area in as3?would be thankful if any guys help me out.....
1
vote
0answers
336 views

Wheel Joint Implementation in AndEngine

I am currently developing car game in AndEngine. In which I was using revolute joint for car wheel and chassis attachment. But my friend suggest me that use wheel joint for that purpose for better ...
2
votes
1answer
410 views

How do I make a rope from point A to B in Box2D?

I need to make a rope (preferably not elastic) from one point to the next in Box2D. If it helps, I'm trying to develop one of those 2D Spiderman games, like this: ...
-3
votes
1answer
352 views

How to fly enemies like galaxian game enemies?

I am developing game like galaxian and using cocos2d with box2d .I don't have idea how to create enemies like galaxian game enemies and how do they fly over the screen. ...
4
votes
2answers
394 views

Detecting a ledge in Box2D [duplicate]

Possible Duplicate: Detect Open Space in Farseer How do I detect ledges? I'm making a 2D platformer with Box2D. The player needs to be able to grab onto a ledge and pull him/herself up. ...
2
votes
3answers
866 views

Rotate Body From Corner

I want to ask that how to rotate body from corner? movableBeam.getBeamBody().setTransform(movableBeam.getBeamBody().getPosition(), angle); The above line of code rotate the beam from center that I ...
1
vote
1answer
505 views

Box2D Bicycle Wheels Motor Problem - Flash 2.1a

I have made a bicycle with Box2D using several polygons for the frame at different angles connected using weld joints, and I have revolute joints on the wheels with a motor. I have made some basic ...
2
votes
1answer
600 views

RagDoll in AndEngine

I want to create a RagDoll body in andEngine which can run and jump over different jumpObjects. Can any one give a nice tutorial on how to create RagDoll body and how to move it, like jump and ...
3
votes
3answers
555 views

Semi Fixed-timestep ported to javascript

In Gaffer's "Fix Your Timestep!" article, the author explains how to free your physics' loop from the paint one. Here is the final code, written in C: double t = 0.0; const double dt = 0.01; double ...
2
votes
1answer
332 views

Implementing a wheeled character controller

I'm trying to implement Boxycraft's character controller in XNA (with Farseer), as Bryan Dysmas did (minus the jumping part, yet). My current implementation seems to sometimes glitch in between two ...
0
votes
1answer
272 views

box2d tween what am I missing

I have a Box2D project and I want to tween an kinematic body from position A, to position B. The tween function, got it from this blog: function easeInOut(t , b, c, d ){ if ( ( t /= d / 2 ) < ...
0
votes
1answer
350 views

GetContactList stops reporting collisions on welded bodies

I have some strange problem with my game which uses Box2D as physics engine and I'm out of ideas on what I can do to solve it. My game is a class assignment where I need to build a simple game where ...
1
vote
0answers
504 views

changing body type without change of center of mass

I have an box2d project with some bodies in it, which move around without any user interaction. But if the user selects one of the bodies, he should be able to move it around just like he wants to. ...
0
votes
2answers
586 views

How to move Objects smoothly like swimming arround

I have a Box2D project that is about to create a view where the user looks from the Sky onto Water. Or perhaps on a bathtub filled with water or something like this. The Object which holds the fluid ...
2
votes
1answer
663 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() { ...
0
votes
1answer
182 views

Box2d — get free space

I am developing a little Game with something like particles, where every particle is represented by a box2d Body. To insert new particles I need to find a place in the b2World where no bodies reside. ...
4
votes
1answer
2k views

making a box2d body move along a Bezier curve/ arc path

I have been trying to make a box2d body move along a Bezier curve/ arc path. Most of the posts I've seen recommend an approach of manipulating SetLinearVelocity and SetTransform to arrive at an ...
1
vote
2answers
2k views

Can i add friction in air?

I have issue regarding speed in air. When i jump and move simultaneously that time speed of player increase.For jump i am using impuls and for movement i am using force.I want to slow speed when ...
1
vote
2answers
717 views

strange behavior in Box2D+LibGDX when applying impulse

I have been playing around with Box2D and LibGDX and have been using a sample code from DecisionTreeGames as the testing ground. Now I have a screen with four walls and a rectangle shape, lets call it ...
6
votes
1answer
696 views

Farseer Physics: Ways to create a Body?

I want to create something similar to this using farsser and Kinect: https://vimeo.com/33500649 This is my implementation until now: http://www.youtube.com/watch?v=GlIvJRhco4U I have the outline ...
0
votes
1answer
234 views

Creating multiple fixtures in one body

I want to create this type of fixture in one body. Here square and circle both are different fixtures but attach to one body. How do I do this?
1
vote
2answers
238 views

Confusing box2d forces

Hello Friends. This is my demo game screen-shoot. Here i am using three buttons. Right-bottom button is used for jump and left-bottom buttons used for move left and right. I have some questions 1) ...
1
vote
0answers
821 views

How to properly add texture to multi-fixture/shape b2Body

Hello to everyone this is my first poste here I hope that will be not fail start. At start I must say I make part 1 in Ray's Tutorial "How To Make A Game Like Fruit Ninja With Box2D and Cocos2D". But ...
1
vote
1answer
169 views

Sprite Body can not stop

Hey i have issue regarding jump sprite body. In my code i am using moveLeft and moveRight Button and when i am press moveRight Button using following code if (moveRight.active==YES) { ...
0
votes
1answer
446 views

moving box2d bodies in an arc or curved path

How can I make a b2Body move in a arc-like or curved path? I have heard about cocos2d Bezier curve function (ccBezier) but this is for moving cocos2d sprites. Or can it be modified to move box2d ...
0
votes
1answer
611 views

EXC_BAD_ACCESS error when box2d joint is destroyed

When I destroy the weldJoint in the update method (see below) I get an EXC_BAD_ACCESS error pointing to the line world->DestroyJoint(weldJoint); in the update method below: -(void) update: ...
0
votes
2answers
452 views

How to move a b2Body explosively to a new Location

I am building an Game based on Box2d with the following basic structure: The Box2d World itself does not have any Gravity and is filled with some bodies (sheres and simple polygons) of more or less ...
1
vote
1answer
1k views

AndEngine Physics: Shape rotating but not updating physics effects

I was looking at PhysicsExample from AndEngine's Examples. I made the following change that I added a vertical line shape and created a fixture for it. Then I registered a rotation modifier for that ...
0
votes
0answers
138 views

Farseer non-colliding bodies affect eachother

I'm trying to use Farseer to make a tile engine, but bodies that are not colliding with a sprite are still having an effect on it. In this image there is a single sprite(the green box) and a single ...
1
vote
1answer
427 views

Cocos2d: Using single timer/scheduler for multiple sprites

want to know if is it possible to use single timer or scheduler method for multiple sprites ? Like I am now working on a game and there could be any number of sprites and i want to perform some ...
3
votes
1answer
331 views

What algorithms exist for generating collision geometry from an image?

I am currently working on a game using SFML and Box2D. I am interested in generating collision geometry from the sprite data that I load into SFML. So, for example, an algorithm that would do this ...
2
votes
0answers
320 views

Box2d based tile map game scrolling problem [closed]

I am using a tile based game and also used a joystick. Using joystick sprite body move perfectly but tile map can not scroll. -(void)setCenterOfScreen:(b2Vec2)position { int ...
-1
votes
1answer
2k views

How change the size of sprite in cocos2d?

I want to change the scale of sprite like a paper in 'Paper Toss' game. 'Paper Toss' is the game is available on the App store. I want to make a sprite like a paper and change the scale of sprite ...
0
votes
1answer
549 views

Cocos2d Box2d contact listener call different method in collided object

I have the building object, wen it hit with other, i want to call some method inside it. Building.mm -(void)printTest { NSLog(@"printTest method work correctly"); } in my ContactListener i ...
1
vote
1answer
563 views

How make a laser path prediction line like a “slingshot cowboy” game?

How so I make a laser path prediction line like a “slingshot cowboy” game in cocos2d or box2d and select the target like "slingshot cowboy" game.
6
votes
2answers
663 views

Show path of a body of where it should go after linear impulse is applied

I am making a game with Andengine and Box2D. I have a dynamic body and I apply linear impulse on the body to move it around when the user have touched the screen. Now I want to show the path where ...
1
vote
1answer
295 views

How do I identify a collision with a specific body?

How can I identify when the ground body collides with another b2Body? I can use b2ContactListener to be notified of collision events, but how do I tell which bodies collided?
-1
votes
1answer
149 views

Interacting with box2D objects

How can I interact with an object in box2d, I'm completely new to this so I have no clue what to do. The box is created like this: bodyDef.type = b2Body.b2_dynamicBody; fixDef.shape = new ...
1
vote
1answer
119 views

Why is the MaskBit maxed out

Hi there for some reason the maskbit of my b2FixtureDef is being maxxed out and im not sure why Here is the declaration of the items that are used in the game enum PhysicBits { PB_NONE = 0x0000, ...
1
vote
2answers
221 views

Box 2D Collision Question

I am very new to Box 2D Physics world. I wanted to know how to collide 2 bodies when one is Dynamic and other is Kinematic. The whole Scenario is explained below: I have 3 balls in total. I want to ...
4
votes
1answer
483 views

Cocos2d: Tongue effect like in Munch Time

I'm wanting to do a tongue effect for my character like the one in Munch Time( shown in pic ). The player does some action and his tongue attaches to the nearest platform. I'm thinking this is ...