Questions tagged [box2d-iphone]

Box2D is a physics engine created by Erin Catto. This tag is similar to the box2d tag in that it is more specifically aimed at iOS development.

Box2D is a physics engine that is particularly popular among Cocos2D developers when developing a game for iOS devices. It is fairly fast and easy to use. More information can be found on its official website:

Box2D.org

For more information on Cocos2D (iOS) see:

Cocos2D-iPhone.org

410 questions
2
votes
3 answers

box2d:Disable bounce on collision

I have some box,creating using box2d,which restitution's are set to zero.but when they fall over one another there appear bounce event.but i don't want that...i want them not move when fall over another.it can be done if i switch off gravity.but i…
Rony
  • 1,229
  • 4
  • 22
  • 42
2
votes
1 answer

Objects that defy gravity but collide with others in Box2D. How?

newbie to iPhone game development and Box2D here. I'm developing a game in which I can move (drag) otherwise stationary objects that can collide with other objects. How do I make these objects stationary in a Box2D world with gravity while…
Delta2038
  • 75
  • 5
2
votes
1 answer

Box2D multiple fixtures vs multiple bodies

I have a game that uses Box2D. Sort of a platformer. It has multiple shapes, forming different objects of a stage. At this point I'm making those by creating separate body for each object (it is more convenient in my implementation of the engine),…
PanCotzky
  • 564
  • 2
  • 5
  • 12
2
votes
1 answer

Set polygonShape to hexagon shape

I'm using LiquidFun with spritekit in objective c, In my Box2d world I want to create b2PolygonShape for my sprite, my sprite is shown in the image below: I tried the following code: b2PolygonShape polygonShape; b2Vec2 vertices[6]; for (int i = 0 ;…
Mariam
  • 683
  • 1
  • 11
  • 27
2
votes
3 answers

Casting to derived type problem in C++

I am quite new to C++, but have worked with C# for years, however it is not helping me here! :) My problem: I have an Actor class which Ball and Peg both derive from on an objective-c iphone game I am working on. As I am testing for collision, I…
GONeale
  • 26,302
  • 21
  • 106
  • 149
2
votes
2 answers

How to use Box2D allocator?

There are two questions here. First if I need to create b2BlockAllocator before Clone and then delete(where?) after clone? Xcode profiling instrument doesn't show C++ leaks... b2FixtureDef fixd = fix->fixture; const b2Shape *shape =…
Pablo
  • 28,133
  • 34
  • 125
  • 215
2
votes
1 answer

Does creating an SKPhysicsJoint between two SKPhysicsBody objects disable collision detection between them?

I've noticed the following: If I create a scene with physics boundaries (bodyWithEdgeLoopFromRect) and two nodes each with a circular solid physics body (bodyWithCircleOfRadius), upon adding these 2 nodes to the scene, they can collide with each…
SaldaVonSchwartz
  • 3,769
  • 2
  • 41
  • 78
2
votes
1 answer

how to use box2d b2Distance function

i know b2Distance is used to compute two shape's distance,but how to use it? i don't know how to set the parameters of b2Distance(),e.g this is the structure of b2DistanceInput , public class b2DistanceInput { public var…
Chailie
  • 451
  • 2
  • 11
  • 24
2
votes
1 answer

Stopping linear velocity on a box2d object

I have just added a linear impulse function to move my object from left to right when the user moves their finger back and forward across the screen. The object is also falling by the worlds gravity. After the object reaches a boundary i want to…
2
votes
0 answers

tracking a 'body's' position after another body joint to it has been destroyed

I have created a revolute joint between two bodies. When a another body gets into contact (see Contacter.mm below) with one of them (body with tag ==90), I destroy the body with tag == 90. I put a CCLOG to track the sprite position of the revolute…
oopology
  • 1,072
  • 1
  • 10
  • 19
2
votes
2 answers

EXC_BAD_ACCESS issue with contact listener

I am getting an EXC_BAD_ACCESS error in my contact listener code. Below is the code: Main object class (GameObjects) through which all objects are subclassed: GameObjects.h: #import "cocos2d.h" #import "CCNode.h" #import "CCPhysicsSprite.h" #import…
dcone
  • 148
  • 8
2
votes
2 answers

making a box2d body move in a spiral motion

How can one make a box2d body move in a spiral motion? I believe it will require applying some force but I am not sure how. I would appreciate any assistance.
oopology
  • 1,072
  • 1
  • 10
  • 19
2
votes
1 answer

Is it possible to join a body from two sides to different static bodies

b2Body* foundation =[self createStaticBodyAtLocation:CGPointMake(15, 15) withSize:CGSizeMake(35, 35)]; b2Body* beam=[self createDynamicBodyAtLocation:CGPointMake(105, 35) withSize:CGSizeMake(150, 10)]; b2RevoluteJointDef…
Mikayil Abdullayev
  • 12,117
  • 26
  • 122
  • 206
2
votes
1 answer

How to Restrict one body to force another body in Box2d?

im creating simple breakout game, in which i have continuing falling bricks which are to be disappeared when ball hits it. but when ball hits that brick, it applies force to it and bricks go upward. so i want ball to stop forcing brick!? , is there…
BaSha
  • 2,356
  • 3
  • 21
  • 38
2
votes
2 answers

ARC is working in iOS 6 but not work in iOS5.1

I am trying to enable ARC(Automatic Reference Count) functionality to my cocos2dbox2d application so i flow this link. ARC is enabled successfully and the application is working fine in iOS 6 but same application crash in ios 5.1. Crash report…
Sudhakar
  • 1,517
  • 1
  • 10
  • 22