box2d

How would I build Box2D to work in Code::Blocks/Mingw32(Windows)

旧街凉风 提交于 2019-11-30 17:20:36
问题 hey the title pretty much says it all. i have been trying different methods from internet sources, but whenever i try something goes wrong..this is where i got Box2D in cMake, i get a bunch of errors when building it(i was going through the steps in the readme.txt, but onfortunately, theyre for Visual C++...) so im wondering hot to set this up as i guess a library (.lib or .a) and use it in my project(my friend passed me his library and when i loaded it in and tried #include ing the box2D

Simulate “Newton's law of universal gravitation” using Box2D

吃可爱长大的小学妹 提交于 2019-11-30 12:16:13
问题 I want to simulate Newton's law of universal gravitation using Box2D. I went through the manual but couldn't find a way to do this. Basically what I want to do is place several objects in space (zero gravity) and simulate the movement. Any tips? 回答1: It's pretty easy to implement: for ( int i = 0; i < numBodies; i++ ) { b2Body* bi = bodies[i]; b2Vec2 pi = bi->GetWorldCenter(); float mi = bi->GetMass(); for ( int k = i; k < numBodies; k++ ) { b2Body* bk = bodies[k]; b2Vec2 pk = bk-

Android libc.so crash?

末鹿安然 提交于 2019-11-30 11:41:34
问题 I'm using AndEngine with the PhysicsBox2DExtension to make a game. My game keeps crashing and I get this in the unfiltered LogCat: 07-06 13:25:27.266: I/DEBUG(19582): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 07-06 13:25:27.266: I/DEBUG(19582): Build fingerprint: 'TMOUS/SGH-T959V/SGH-T959V/SGH-T959V:2.2.1/FROYO/VUVKD1:user/release-keys' 07-06 13:25:27.274: I/DEBUG(19582): pid: 22238, tid: 22263 >>> com.prattia.webs.testgfx5 <<< 07-06 13:25:27.274: I/DEBUG(19582): signal

Multiple fixtures on one body or multiple bodies?

梦想的初衷 提交于 2019-11-30 02:57:20
问题 Let's say I wanted to create 1000, or maybe even 5000 static body lines on the screen. What I am wondering is, what is the difference between attaching all of these lines (fixtures) onto a single body, or placing each fixture onto its own body. Is there a performance difference between the two methods, or does one method provide more functionality or control over the other method? Below shows the difference between both methods. Attaching each line onto a single body: // Create our body

Android libc.so crash?

只愿长相守 提交于 2019-11-30 02:30:39
I'm using AndEngine with the PhysicsBox2DExtension to make a game. My game keeps crashing and I get this in the unfiltered LogCat: 07-06 13:25:27.266: I/DEBUG(19582): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 07-06 13:25:27.266: I/DEBUG(19582): Build fingerprint: 'TMOUS/SGH-T959V/SGH-T959V/SGH-T959V:2.2.1/FROYO/VUVKD1:user/release-keys' 07-06 13:25:27.274: I/DEBUG(19582): pid: 22238, tid: 22263 >>> com.prattia.webs.testgfx5 <<< 07-06 13:25:27.274: I/DEBUG(19582): signal 11 (SIGSEGV), fault addr deadbaad 07-06 13:25:27.286: I/DEBUG(19582): r0 00000000 r1 afd14921 r2

Simulate “Newton's law of universal gravitation” using Box2D

雨燕双飞 提交于 2019-11-30 02:24:41
I want to simulate Newton's law of universal gravitation using Box2D. I went through the manual but couldn't find a way to do this. Basically what I want to do is place several objects in space (zero gravity) and simulate the movement. Any tips? It's pretty easy to implement: for ( int i = 0; i < numBodies; i++ ) { b2Body* bi = bodies[i]; b2Vec2 pi = bi->GetWorldCenter(); float mi = bi->GetMass(); for ( int k = i; k < numBodies; k++ ) { b2Body* bk = bodies[k]; b2Vec2 pk = bk->GetWorldCenter(); float mk = bk->GetMass(); b2Vec2 delta = pk - pi; float r = delta.Length(); float force = G * mi * mk

LIBGDX: What is a “viewport”?

和自甴很熟 提交于 2019-11-29 21:28:32
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 rectangle opening of a lens of the camera that views LIBGDX's Game world, where I can move it about the world to view what I want". But, after more reading, I seemed to be nowhere near the actual meaning. I've read the LIBGDX wiki, and read in the OpenGL documentation, which seem to explain viewport as being two different things. LIBGDX Wiki: "The

Libgdx and Box2d Detect Collision of two specific bodies

喜欢而已 提交于 2019-11-29 16:32:21
I have two bodies, both dynamic, one of them I have turned off the gravity and only want to turn it on when it is hit by my other body. I know I can set my own contact listener but I want to specify an action only if two specific bodies touch. Any one have any guidance? U can set the userdata of the body and use it like that public class GameColiision implements ContactListener { public GameColiision() { } @Override public void beginContact(Contact contact) { // TODO Auto-generated method stub Body a=contact.getFixtureA().getBody(); Body b=contact.getFixtureB().getBody(); a.getUserData(); if(a

How to compile Box2D in Linux?

こ雲淡風輕ζ 提交于 2019-11-29 15:18:36
Compiling the Box2d Tesbed is supposed to be simple: from iforce2d : Download the Box2D source code archive from here. If you want to use the terminal all the way, you could also do this (if wget is not available, use yum to install it): wget http://box2d.googlecode.com/files/Box2D_v2.1.2.zip Use the following commands to unzip and build it. [...] unzip Box2D_v2.1.2.zip cd Box2D_v2.1.2/Box2D/Build cmake .. make ( These instructions are pretty old, I did get my source with git clone https://github.com/erincatto/Box2D.git ) Running cmake .. from Box2D/Build in the freshly cloned directory causes

Sprite Kit failing assertion: (typeA == b2_dynamicBody || typeB == b2_dynamicBody)

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 15:00:06
This was asked earlier , but the original asker didn't need to change the dynamic property so he answered his own question by unasking it. I'm using Sprite Kit in iOS7 and I'd like to be able to change an SKPhysicsBody's dynamic property at runtime. Originally I was changing that in my touchesBegan: method. Someone in the Apple Dev forum suggested moving the change to the didSimulatePhysics: method but that didn't help either. This code causes the error: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { if (!heyWereSwappingDynamismHere) { heyWereSwappingDynamismHere = YES;