box2d

Box2D in Flash runs quicker when drawing debug data than not

I've created a small game with Box2d for AS3 - I have sprites attached to the stage that take their position from the underlying Box2d world. These sprites are mostly PNGs. When the game runs with DrawDebugData() bening called every update, it runs nice and smoothly. However when I comment this out, it runs choppily. In both cases all m...

Farseer or Box2D? Top-down shooter physics implementation

Which one of these would fit a top down shooter better? I've heard that Box2D performs faster, but I've also noticed that it lacks wider community support for XNA (it rather seems to be used for flash - for a reason unknown to me). Farseer is however built for XNA, and seems to fit it and perform pretty fine. Farseer's advantage in my ...

Box2d: mousejoint jerky

Hi to all! I'm making my first iPhone game. I have increasing number balls that can be dragged. I had some problems with inertial delay of mousejoint and I configured them as follows: b2MouseJointDef md; md.body1 = _groundBody; md.body2 = body; md.target = p; md.maxForce = 10000.0f * body->GetMass(); md.dampingRatio = 0; md.frequencyH...

C# XNA Box2d: ApplyImpulse() acts surprisingly

I'm trying to move a body: if (ks.IsKeyDown(Keys.Up)) { rocket.ApplyImpulse(new Box2DX.Common.Vec2(0, 30f), rocket.GetPosition()); } Oddly, the body only moves when the key is released. Why is this? I've been looking at the manual but can't figure it out. When I remove the conditional, and just have the applyImpulse() call in Ste...

C# XNA Box2d: What kind of joints for a ragdoll?

I'm trying to make a ragdoll out of a bunch of bodies. What kind of joints do I want to connect them? Distance joints? ...

removing bounce off colliding objects in box2d

Hi, I am trying to delete an object in box2d when 2 object collide. When my 2 objects do collide, one of the object bounces off the other. it does delete the other object, but i want it to make it look like it went through rather than a bounce. I have my body Def type set to b2_staticBody. Any help would be appreciated. ...

How to set the position of a sprite within a box2d body?

Basically I have 2 polygons for my body. When I add a sprite for userData, the position of the texture isn't where I want it to be. What I want to do is adjust the position of the texture within the body. Here's the code sample of where I am setting this: CCSpriteSheet *sheet = (CCSpriteSheet*) [self getChildByTag:kTagSpriteSheet]; CCSp...

Does Box2d work on Xbox?

I'm developing a game in XNA. It would be nice for it to be compatible with Xbox. Does Box2d work on Xbox? Is there some way to include any third party libraries I use? ...

Breaking a concave polygon into convex ones.

I'm using a game physics library (Box2D) which only supports convex polygon shapes. However, I'd like the level builder to be able to just specify concave polygons without having to worry about that. So, how can I automatically break apart a concave polygon into convex ones (or even all triangles). Speed would be cool, but ease of imple...

Asking Box2d if a collision happened

I'm using Box2dx (ported to C#; optimized for XNA). It handles collision resolution, but how can I tell if two objects are currently colliding? This is the function I'm trying to write: public bool IsColliding(GameObjectController collider1, GameObjectController collider2) Where collider1.Model.Body is the Box2d Body, and collider1.M...

Box2dx: Usage of World.QueryAABB?

I'm using Box2dx with C#/XNA. I'm trying to write a function that determines if a body could exist in a given point without colliding with anything: /// <summary> /// Can gameObject exist with start Point without colliding with anything? /// </summary> internal bool IsAvailableArea(GameObjectModel model, Vector2 point) ...

2d trajectory planning of a spaceship with physics.

I'm implementing a 2D game with ships in space. In order to do it, I'm using LÖVE, which wraps Box2D with Lua. But I believe that my question can be answered by anyone with a greater understanding of physics than myself - so pseudo code is accepted as a response. My problem is that I don't know how to move my spaceships properly on a 2...

Friction in Box2d

I am using Box2d for a topdown game. The "ground" is a series of tiles, where each tile is a static body with a sensor shape. Can I make friction take effect for this, even though the objects aren't really "colliding" with the ground? If Box2d won't let me do this, I considered trying to implement my own by detecting what force is curre...

Box2dx: Specify fixtures to ignore in raycasting?

Everybody in my game world has fixtures with sensor shapes attached. When I raycast, it hits these fixtures, but I only want to hit fixtures with at least one shape that is not a sensor. Is this possible? I'm using Box2dx - the C# port. Also, what does the callback do? world.PhysicsWorld.RayCast((f, p, n, fr) => { ...

Box2d: Maximum possible linear velocity?

I think I've configured Box2d to have some sort of maximum velocity for any body, but I'm not sure. I apply an impulse like (100000000, 100000000), and the body moves just as fast as (100, 100) - which is not that fast at all. I'm using the Box2d XNA C# port. My game is a top-down 2d. Here is some code that may be relevant: private r...

Box2d: Set active and inactive

I'm writing an XNA game in C# using the XNA port of Box2d - Box2dx. Entities like trees or zombies are represented as GameObjects. GameObjectManager adds and removes them from the game world: /// <summary> /// Does the work of removing the GameObject. /// </summary> /// <param name="controller">The GameObject to be remo...

physics game programming box2d - orientating a turret-like object using torques

This is a problem I hit when trying to implement a game using the LÖVE engine, which covers box2d with Lua scripting. The objective is simple: A turret-like object (seen from the top, on a 2D environment) needs to orientate itself so it points to a target. The turret is on the x,y coordinates, and the target is on tx, ty. We can consid...

Box2d + CoCos2d: Moving an Object automatically to simulate computer movement in a game

I am working on a hockey game and I am implementing Single Player mode. I am trying to move the "computer's" paddle in offense mode (move towards the ball). I am using CoCos2d and Box2d. I am moving the paddle using MouseJoints. The problem is the Paddle doesnt move at all! tick is called in init method [self schedule:@selector(tick:)...

Only Integrating Box2D collision detection in my 2d engine?

I have integrated box2d in my engine, ( Debug Draw, etc. ) and with a world I can throw in some 2d squares/rectangles etc. I saw this post, where the user is basically not using a world for collision detection, however the user doesn't explain anything about how he's using the manifold (b2Manifold), etc. Another post, is in the cocos2d...

Problem Building dschaefer / android-box2d

I'm trying to build dschaefer android-box2d, and did follow the recipe. I do get this error when trying to build the TestBox2d with eclipse: make all /cygdrive/c/android/android-ndk-r3/build/prebuilt/windows/arm-eabi-4.2.1/bin/arm-eabi-ld \ -nostdlib -shared -Bsymbolic --no-undefined \ -o obj/libtest.so obj/test.o -L../box2d/lib/andro...