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.

3243 questions
92
votes
6 answers

Which Box2D JavaScript library should I use?

There are a few different ports of Box2D for JavaScript. Which one is the best? Box2DJS - "converted from Box2DFlashAS3_1.4.3.1 in an automatic manner" Box2Dflash 2.0 ported to JavaScript - "one big nasty hack that just happens to work" box2dweb -…
a paid nerd
  • 28,574
  • 30
  • 121
  • 167
34
votes
3 answers

What does cmake .. do?

I got the Box2D project source and want to compile the testbed portion of it. The project folder contains folders like: freeglu glui testbed(a demo) helloword(a demo) Box2D Build CMakeFiles There are many CMakeLists.txt in all the different…
batman
  • 4,216
  • 9
  • 44
  • 77
29
votes
9 answers

Calculate the distance between two CGPoints

i need to calculate the distance between two CGPoints. I refered this and this, but I don't get it.
iCoder86
  • 1,634
  • 6
  • 24
  • 44
26
votes
2 answers

Move body to a specific position - Box2D

I have a b2Body which I would like to move at a certain target position. I don't want to use the SetPosition function. How can I achieve this using : Changing linear velocities. Using mouseJoint. (The target position is fixed. Mouse is NOT…
Anubhav Sharma
  • 348
  • 1
  • 5
  • 14
26
votes
1 answer

LIBGDX: What is a "viewport"?

This post is related to an earlier post of wanting to learn how to properly render in between LIBGDX and Box2D. I had to understand viewport well before I could proceed. After much code/post readings, I felt the meaning of "viewport" was "the…
coffeenet
  • 523
  • 1
  • 6
  • 15
23
votes
1 answer

Libgdx game crashes on Android

I made a game using libgdx and it runs fine on both desktop and android before. I'm not sure if its because I started using box2d physics engine and liquidfun particles,what basically happens is that when I click play on my game it start loading…
Kevin Bryan
  • 1,647
  • 2
  • 17
  • 33
21
votes
3 answers

Cocos2d + Box2d or Chipmunk

OK, im trying to make an iphone version of a game i made here http://scratch.mit.edu/projects/techy/781198 is box2d or chipmunk better and where are some tutorials for each one
techy
  • 544
  • 2
  • 6
  • 20
21
votes
3 answers

Javascript physics engine and simulated infinite curve

I'm trying to do a Tiny Wings like in javascript. I first saw a technique using Box2D, I'm using the closure-web version (because of the memory leaks fix). In short, I explode the curve into polygons so it looks like that: I also tried with…
SuperSkunk
  • 1,218
  • 10
  • 24
20
votes
6 answers

SpriteKit physics in Swift - Ball slides against wall instead of reflecting

I have been creating my own very simple test game based on Breakout while learning SpriteKit (using iOS Games by Tutorials by Ray Wenderlich et al.) to see if I can apply concepts that I have learned. I have decided to simplify my code by using an…
19
votes
3 answers

Why use Float.floatToIntBits() in Java float comparisons?

In JBox2d, there exists the following code for Vec2.equals(): @Override public boolean equals(Object obj) { //automatically generated by Eclipse if (this == obj) return true; if (obj == null) return false; if (getClass()…
Engineer
  • 7,543
  • 7
  • 57
  • 96
18
votes
1 answer

iPhone physics engine for fluid/water simulation?

I'm about to start developing a game that's main feature revolves around 2D water simulation. I have thought about starting with Box2D and designing water in that engine, but I'm not sure if it would be efficient, and I don't have any experience…
Gus
  • 1,639
  • 4
  • 19
  • 35
18
votes
4 answers

Applying physics to Android View objects

I currently have an android application that utilises the native android views for the UI (e.g. imageviews/buttons etc) Although this app is not a game, nor requires any heavy graphics or OpenGL, I would like to incorporate a little physics-related…
Kurian Vithayathil
  • 717
  • 2
  • 6
  • 20
18
votes
2 answers

Proper Swipe gesture recognizer iOS

I haven't been able to find a tutorial on how to properly setup a gesture recognizer for iOS. I need to detect swipe up & down, and the callbacks for them. Any help, appreciated. Thanks.
iamruskie
  • 716
  • 4
  • 9
  • 21
15
votes
1 answer

Box2d multiple fixtures and positioning

I'm attempting to create a "U" shape in Box2d (in Cocos2d) by joining 3 rectangles like so: |_| It sounds like joints are not the correct solution here since I don't want any movement so I have created a main body which is the middle bit and 2…
GivP
  • 2,458
  • 6
  • 29
  • 31
15
votes
2 answers

CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles"

I am trying to use cmake to build the Box2D library for c++. When I run cmake gui I get the error: CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select…
Starfruit
  • 167
  • 1
  • 1
  • 6
1
2 3
99 100