box2d

Objective-C++ importing C++ class fails, cassert not found

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So I want to publicly expose a Box2D (C++) pointer to other Objective-C++ classes in my cocos2d + box2d project. I declare a method "getWorld" in my interface which references C++ class b2World and imports Box2D.h. All the files in my project are .mm extension, and I get the following compile error: In file included from DebugDrawLayer.mm:2: In file included from World.h:10: In file included from external/Box2d/Box2D/Box2D.h:34: external/Box2d/Box2D/Common/b2Settings.h:22:10: fatal error: 'cassert' file not found #include <cassert> I guess

Calculate the distance between two CGPoints

心已入冬 提交于 2019-12-02 23:43:48
i need to calculate the distance between two CGPoint s. I refered this and this , but I don't get it. Well, with stuff your refering too where is the full code: CGPoint p2; //[1] CGPoint p1; //Assign the coord of p2 and p1... //End Assign... CGFloat xDist = (p2.x - p1.x); //[2] CGFloat yDist = (p2.y - p1.y); //[3] CGFloat distance = sqrt((xDist * xDist) + (yDist * yDist)); //[4] The distance is the variable distance. What is going on here: So first off we make two points... Then we find the distance between x coordinates of the points. Now we find the distance between the y coordinates. These

ChainShape in Box2D

蓝咒 提交于 2019-12-02 19:11:17
问题 I recently began to learn libgdx and I am stuck at a problem with the CainShape of Box2D. My first goal is to simply create a box with a ChainShape. In order to achieve that, I added four Vector2 to an array and use them to create a loop. The result is depending on the arrangement in the array either an hourglass shaped thing (top left is connected with bottom right and top right is connected with bottom left) or the error Expression: b2DistanceSquared(v1, v2) > 0.005f * 0.005f This is the

Physics Body Editor error

女生的网名这么多〃 提交于 2019-12-02 17:58:05
问题 I get this error when trying to initialize BodyEditorLoader from this library http://www.aurelienribon.com/blog/projects/physics-body-editor/ Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape()J at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:127) Caused by: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.physics.box2d.PolygonShape

Cocos2d + Box2d or Chipmunk [closed]

断了今生、忘了曾经 提交于 2019-12-02 15:16:32
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 If you download the Cocos2d SDK, in the included project is a sample of Box2d and Chipmunk. Just open the Xcode project called "cocos2d-iphone" and look Box2dtest and Chipmunkdemo. Box2d is more powerful, but I think a little harder to use than Chipmunk. Here's the site for Cocos2d: http://www.cocos2d-iphone.org/ Download here: http://www.cocos2d-iphone.org/download Mark7777G I prefer Box2d - I think it is easier to

Fixing two box2D bodies together securely

有些话、适合烂在心里 提交于 2019-12-02 11:39:13
问题 I am trying to join two box2d bodies together that are separated over a fixed distance. Both bodies cannot rotate themselves, and the join should have to rotation either. The gap between the bodies needs to allow other bodies to pass through. I currently have a b2revoluteJoint setup like so: b2RevoluteJointDef rjd; rjd.lowerAngle = 0.0f; rjd.upperAngle = 0.0f; rjd.Initialize(body2, body1, body2->GetPosition()); rjd.collideConnected = false; world->CreateJoint(&rjd); However the joint is not

How to enable Box2d debug draw with Coco2d-x 3.0 beta 2

纵饮孤独 提交于 2019-12-02 11:15:38
How I should enable debug draw with Cocos2d-x 3.0? There are some codes that do that with cocos2d-x 2.0 but they don't even compile on Cocos2d-x. Unfortunately I am new to both cocos2d-x and Box2d and I don't know how to port them. That would be great if you would share the method how you draw shapes. EDIT: I have found this: http://blog.csdn.net/tian2kong/article/details/20386213 I have overridden the draw method of my applications main Layer like this: void HelloWorld::draw() { GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION); kmGLPushMatrix(); m_world->drawDebugData(); kmGLPopMatrix

Fatal signal 11 (andengine project)

隐身守侯 提交于 2019-12-02 10:10:10
I'm creating and android game powered by andengine framework the box2d extension I'm getting "Fatal Signal 11" which seems to happen out of nowhere (I guess you can call it randomly) there no clues (at least, I don't aware to any clues to help me solve this problem) my guesses are: 1) I'm creating game's entities using TimerTask class 2) maybe it has something to do with concurrency? what do you think? thanks, socksocket You could still use a TimerTask, you just need to be sure to call anything relating to AndEngine (creating or deleting sprites, etc) on the AndEngine update thread - you can

Box2d libgdx, a bit confused about the pixels to meters stuff

社会主义新天地 提交于 2019-12-02 09:42:12
So I understand the concept. The idea is that box2d more or less works in meters, so you need to do a conversion from pixels to it. Makes sense. I was following the tutorial/intro to box2d here . It mentions to do the conversion and gives you some example amounts to use. Now, that's all well and good, but I find when I'm using such techniques, the debugger box doesn't seem to render where they should. The collision does work as expected however. In my GameScreen class, here's how I initialize the ground: ground = new BodyDef(); // set the position half way up the ground ground.position.set(0

ChainShape in Box2D

感情迁移 提交于 2019-12-02 08:39:37
I recently began to learn libgdx and I am stuck at a problem with the CainShape of Box2D. My first goal is to simply create a box with a ChainShape. In order to achieve that, I added four Vector2 to an array and use them to create a loop. The result is depending on the arrangement in the array either an hourglass shaped thing (top left is connected with bottom right and top right is connected with bottom left) or the error Expression: b2DistanceSquared(v1, v2) > 0.005f * 0.005f This is the code I used so far: Vector2[] box = new Vector2[4]; box[1] = new Vector2(0 - bounds.getWidth() / 2 / Main