chipmunk

Cocos2d + Box2d or Chipmunk [closed]

谁说胖子不能爱 提交于 2019-12-20 08:24:43
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . 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 回答1: If you download the Cocos2d

How to access Physics World in Layer

拟墨画扇 提交于 2019-12-13 01:29:27
问题 I need to create joint between two bodies in layer. Joints are to be added in physics world. How can i access physics world in layer? 回答1: My JavaScript implementation. Hope it will help. var space; function initPhysics() { space = new cp.Space(); space.gravity = cp.v(0, -800); space.iterations = 30; space.sleepTimeThreshold = Infinity; space.collisionSlop = Infinity; } function addJoints() { chainTableJoint1 = new cp.PivotJoint(chainEnd1, tableBackBody, cp.v.add(cp.v(chainEnd1.getPos().x,

Using Pymunk with Pyinstaller

喜你入骨 提交于 2019-12-12 04:25:46
问题 I have literally found nothing googling that could help. Even for py2exe but I would like to use pyinstaller. My problem is the module (pymunk[aka Chipmunk]) is not fully included in the exe build. It is probably missing some kind of dll. Basically its missing a dependency I don't know how to solve. Failed to load pymunk library. This error usually means that you don't have a compiled version of chipmunk in the correct spot where pymunk can find it. pymunk does not include precompiled

Segmentation fault on library call

不问归期 提交于 2019-12-12 02:48:15
问题 I'm using a physics library called Chipmunk for a game that I'm writing. In my initialize function I initialize the global variable cpSpace space . Then in update I call cpSpaceStep(space, timestep) . The prototype for this function is void cpSpaceStep(cpSpace *space, cpFloat dt); . I'm getting a segfault on this function call. I've marked those two function calls in the code below. The full code is below: #include "../include/SDL/SDL_image.h" #include "../include/SDL/SDL.h" #include "..

chipmunk collision too soft

风格不统一 提交于 2019-12-11 13:16:14
问题 I'm new to physics in cocos2d. I'm using chipmunk, and when two object collide, its just to "soft", like they where made of sponge or rubber. My code: cpInitChipmunk(); space = cpSpaceNew(); space->gravity = cpv(0, 0); schedule(schedule_selector(HelloWorld::step), 1.0f/60.f); astroBody = cpBodyNew(100, INFINITY); astroBody->p = cpv(512,384); cpSpaceAddBody(space, astroBody); int num2 = 8; cpVect vertsAstro[] = { cpv(-17.0f, -44.9f), cpv(-29.5f, -33.2f), cpv(-32.9f, -13.1f), cpv(-24.0f, 11.7f)

Chipmunk collision detection

删除回忆录丶 提交于 2019-12-07 06:24:35
问题 I am completely new to chipmunk and I have just been using it for a few days, so I'm guessing this is something pretty obvious, however I cannot find any documentation for this. Is there any callback or method in chipmunk that tells you that 2 given shapes have collided?. If not is the best way to simply use cgrectcontains on the sprites?. -Oscar 回答1: You can get to it from Ipthnc's link, but this is the documentation you're probably looking for - it details the collision callback system:

How to make a dynamic body static in Cocos2d v3.0 with Chipmunk

对着背影说爱祢 提交于 2019-12-04 22:02:54
I’m using Cocos2d v3 and want to change a body from dynamic to static after colliding with another body. At the moment I’ve got: -(void)ccPhysicsCollisionPostSolve:(CCPhysicsCollisionPair *)pair static:(CCNode *)nodeA wildcard:(CCNode *)nodeB { _player.physicsBody.type = CCPhysicsBodyTypeStatic; } or -(BOOL)ccPhysicsCollisionPreSolve:(CCPhysicsCollisionPair *)pair static:(CCNode *)nodeA wildcard:(CCNode *)nodeB { _player.physicsBody.type = CCPhysicsBodyTypeStatic; return YES; } but neither works. I get the error: Aborting due to Chipmunk error: This operation cannot be done safely during a

quick-cocos2d-x物理引擎之chipmunk(二)

 ̄綄美尐妖づ 提交于 2019-12-03 17:37:37
上一篇讲了quick-cocos2d-x使用chipmunk的使用流程,介绍了World,Body,Shape的建立,这一篇将讲解如何处理物体之间的碰撞。 一、监听事件 quick-cocos2d-x中的chipmunk碰撞处理是通过监听事件来实现的。 -- 设置物体的碰撞类别,默认所有物体都是类别0 Body:setCollisionType(type) -- handle是一个回调函数,碰撞处理将在这个函数中执行 -- collisionTypeA和collisionTypeB是两个int值,表示要监听的是哪两种物体 -- 这两个值在body中设置(上面所示的方法),两个值相同时为监听同种物体之间的碰撞 World:addCollisionScriptListener(handler, collisionTypeA, collisionTypeB) -- handler回调函数,这个函数一定要返回true,不然碰撞后两个物体将会重合,即像是不碰撞一样 -- eventType为碰撞的类别,有四种值: -- begin 开始碰撞 -- preSolve 持续碰撞(相交),可以设置相交时独自的摩擦,弹力等 -- postSolve 调用完preSolve后,做后期处理,比如计算破坏等等 -- separate 分开,当删除一个shape时也会调用 --

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

quick-cocos2d-x物理引擎之chipmunk(一)

半城伤御伤魂 提交于 2019-12-02 09:45:56
chipmunk是一个用C写成的物理引擎,quick-cocos2d-x已经用C++对其进行封装,导出到lua的类有: CCPhysicsWorld CCPhysicsBody CCPhysicsShape CCPhysicsDebugNode CCPhysicsCollisionEvent CCPhysicsVector 可以看出,quick-cocos2d-x没有对joint(连接)进行封装 ,下面将就如何在quick-cocos2d-x中使用chipmunk作详细的介绍。 一、简介 1、 World,Body,Shape 可用下图说明其关系 可以看出,World由Body组成,而Body又由Shape组成。就像我们所处的世界一样,世界由房屋,树木等等构成,而房屋由门窗,墙壁等组成,树木由叶子,树干,树枝等组成。 2、 CCPhysicsDebugNode 是用于显示各个物体的边框等等信息,主要用于调试。 3、 CCPhysicsCollisionEvent 是物体之间发生碰撞时产生的事件,事件中携带有碰撞时的信息。 4、 CCPhysicsVector 则是向量,物体受力时将会用到。 二、使用流程 1、 建立World 我们要使用chipmunk,首选要建立一个世界( CCPhysicsWorld ) -- 建立没有引力的世界 CCPhysicsWorld:create()