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
5
votes
3 answers

How to add Box2d to an existing Xcode/Cocos2d Project

I have a working Xcode project that includes Cocos2d in one of the views. I now need to add Box2d. I tried dragging the Box2D folder into the libs directory of my cocos2d-2.x-ARC-iOS folder and adding to that target, but I'm getting this when I…
soleil
  • 12,133
  • 33
  • 112
  • 183
5
votes
2 answers

Images are not displayed and showing error like "cocos2d: CCTexture2D: Using RGB565 texture since image has no alpha"

I am making an application using Box2D in which i am getting images from Asset Library and displaying them as sprites. here is the code which i have done : Getting Images from asset library : CGImageRef imgRef = [[mutArrAssetPhotos objectAtIndex:i]…
Mansi Panchal
  • 2,357
  • 18
  • 27
4
votes
1 answer

A (physical) string with a weight in iOS

I'd like to implement a (physical) string with a weight in iOS, that reacts to accelerometer input and colides against the view bounds. What is the simplest way to do this? I would prefer to avoid using external frameworks like Box2D, unless of…
hpique
  • 119,096
  • 131
  • 338
  • 476
4
votes
4 answers

Box2d elastic rope joint

I'm writing a game, and I need to make up a rope. I maked it by b2RopeJoint, but there I have not found an opportunity to make it elastic. Then I looked for b2DistanceJoint, everything is cool with the elasticity, but I can't find an ability to set…
Gralex
  • 4,285
  • 7
  • 26
  • 47
4
votes
2 answers

Making a Box2d object follow a predetermined path

I'm making a game in which a certain object (modelled as a box2d body) has to follow a fixed path. Is there a way by which I can specify the path coordinates and make the object advance over it for each dt? Thanks
Nav
  • 1,185
  • 16
  • 23
4
votes
3 answers

declare obj-c class interface that contain c++ class type ivar

Currently I am working on a cocos2d+Box2D project so I have deal with some Objective-C++ code. And I am facing to such situation: #import "cocos2d.h" #import "Box2D.h" @interface BasicNode : CCNode { @private ccColor3B _color; b2Body…
Bryan Chen
  • 45,816
  • 18
  • 112
  • 143
4
votes
2 answers

Fast moving bodies in Box2d sometimes pass through each other

I know that fast moving bodies in Box2d world cause tunneling effect and pass through each other. Solution is to define the bodies as bullets. I did that but bodies sometimes still cross each other especially if encounter point is not exactly…
WaJiyaz
  • 512
  • 1
  • 8
  • 25
4
votes
1 answer

Unstable b2RevoluteJoint Box2D

here is my problem, please see video: https://www.youtube.com/watch?v=UFXye1mMr04 When biggest body pushes my rope - it becomes crazy. I need to use mousejoint in my game and user can grab big object and hit that rope. If I increase size of each…
KAMIKAZE
  • 420
  • 6
  • 27
4
votes
1 answer

Movement of Box2d Body in cocos2d-x

I need to move the box2d body according to position received form game center server. After receiving position I just update the body position using: - Carbody->SetTransform(b2Vec2(serverposition.x,serverposition.y),0); But its moving the body…
Sri
  • 827
  • 8
  • 34
4
votes
2 answers

Mirroring Box2D shape

I use the following code to flip the shape. When I flip along x or y, it appears that shape is flipped. b2FixtureDef fixd = fix->fixture; const b2Shape *shape = fixd.shape; if(shape->GetType()== b2Shape::e_polygon && flip) { b2PolygonShape*…
Pablo
  • 28,133
  • 34
  • 125
  • 215
4
votes
1 answer

why is userdata set to self?

In several box2d code samples I've seen this line of code: body->SetUserData(self); In my search I have not found any explanation for this. What is the main purpose for setting the userdata to self in box2d?
oopology
  • 1,072
  • 1
  • 10
  • 19
4
votes
2 answers

Implement animated Button in cocos2d

I wish to clone the effects of the button animations found in Candy Crush Saga. And also I wish to know how to do such fluid & beautiful animations. Is it possible with Cocos2d-iPhone? This is the link of Candy Crush…
Renaissance
  • 564
  • 5
  • 26
4
votes
1 answer

How to manually make a dynamic body(ball) to pass into the box in box2d iPhone

As I am newbie to the cocos2d and I am struggling alot.Can anyone suggest me how to work on this. I am having 3 boxes(which are kinematic bodies) Also having multiple balls(which are dynamic bodies) which is having a tag value(box number) for each…
Monish Kumar
  • 2,788
  • 4
  • 38
  • 54
4
votes
2 answers

How to create a preview trajectory in cocos2d/box2d when start and end points are known but height is variable?

I am an experienced iPhone dev, but new to Cocos2D and Box2D, and I fully admit I need a physics refresher. What I am looking to build is a preview trajectory (an arc indicating a projectiles flight path based on input variables - similar to what is…
4
votes
2 answers

Simple 2D game on iPhone with cocos2d - tips and tricks

I'd like to create a simple 2d game: There is a car in the middle of the screen and the background is moving back resulting the feeling of the speed of the car. The road has uphill and downhill as well so the car has to follow its shape. The user…
haxpanel
  • 4,402
  • 4
  • 43
  • 71
1
2
3
27 28