Search Results

Search found 15892 results on 636 pages for 'box2d iphone'.

Page 1/636 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • 2D Procedural Terrain with box2d Assets

    - by Alex
    I'm making a game that invloves a tire moving through terrain that is generated randomly over 1000 points. The terrain is always a downwards incline like so: The actual box2d terrain extends one screen width behind and infront of the circular character. I'm now at a stage where I need to add gameplay elements to the terrain such as chasms or physical objects (like the demo polygon in the picture) and am not sure of the best way to structure the procedural generation of the terrain and objects. I currently have a very simple for loop like so: for(int i = 0; i < kMaxHillPoints; i++) { hillKeyPoints[i] = CGPointMake(terrainX, terrainY); if(i%50 == 0) { i += [self generateCasmAtIndex:i]; } terrainX += winsize.width/20; terrainY -= random() % ((int) winsize.height/20); } With the generateCasmAtIndex function add points to the hillKeyPoints array and incrementing the for loop by the required amount. If I want to generate box2d objects as well for specific terrain elements, I'll also have to keep track of the current position of the player and have some sort of array of box2d objects that need to be created at certain locations. I am not sure of an efficient way to accomplish this procedural generation of terrain elements with accompanying box2d objects. My thoughts are: 1) Have many functions for each terrain element (chasm, jump etc.) which add elements to be drawn to an array that is check on each game step - similar to what I've shown above. 2) Create an array of terrain element objects that string together and are looped over to create the terrain and generate the box2d objects. Each object would hold an array of points to be drawn and and array of accompanying box2d objects. Any help on this is much appreciated as I cannot see a 'clean' solution.

    Read the article

  • Box2D Joints in entity components system

    - by Johnmph
    I search a way to have Box2D joints in an entity component system, here is what i found : 1) Having the joints in Box2D/Body component as parameters, we have a joint array with an ID by joint and having in the other body component the same joint ID, like in this example : Entity1 - Box2D/Body component { Body => (body parameters), Joints => { Joint1 => (joint parameters), others joints... } } // Joint ID = Joint1 Entity2 - Box2D/Body component { Body => (body parameters), Joints => { Joint1 => (joint parameters), others joints... } } // Same joint ID than in Entity1 There are 3 problems with this solution : The first problem is the implementation of this solution, we must manage the joints ID to create joints and to know between which bodies they are connected. The second problem is the parameters of joint, where are they got ? on the Entity1 or Entity2 ? If they are the same parameters for the joint, there is no problem but if they are differents ? The third problem is that we can't limit number of bodies to 2 by joint (which is mandatory), a joint can only link 2 bodies, in this solution, nothing prevents to create more than 2 entities with for each a body component with the same joint ID, in this case, how we know the 2 bodies to joint and what to do with others bodies ? 2) Same solution than the first solution but by having entities ID instead of Joint ID, like in this example : Entity1 - Box2D/Body component { Body => (body parameters), Joints => { Entity2 => (joint parameters), others joints... } } Entity2 - Box2D/Body component { Body => (body parameters), Joints => { Entity1 => (joint parameters), others joints... } } With this solution, we fix the first problem of the first solution but we have always the two others problems. 3) Having a Box2D/Joint component which is inserted in the entities which contains the bodies to joint (we share the same joint component between entities with bodies to joint), like in this example : Entity1 - Box2D/Body component { Body => (body parameters) } - Box2D/Joint component { Joint => (Joint parameters) } // Shared, same as in Entity2 Entity2 - Box2D/Body component { Body => (body parameters) } - Box2D/Joint component { Joint => (joint parameters) } // Shared, same as in Entity1 There are 2 problems with this solution : The first problem is the same problem than in solution 1 and 2 : We can't limit number of bodies to 2 by joint (which is mandatory), a joint can only link 2 bodies, in this solution, nothing prevents to create more than 2 entities with for each a body component and the shared joint component, in this case, how we know the 2 bodies to joint and what to do with others bodies ? The second problem is that we can have only one joint by body because entity components system allows to have only one component of same type in an entity. So we can't put two Joint components in the same entity. 4) Having a Box2D/Joint component which is inserted in the entity which contains the first body component to joint and which has an entity ID parameter (this entity contains the second body to joint), like in this example : Entity1 - Box2D/Body component { Body => (body parameters) } - Box2D/Joint component { Entity2 => (Joint parameters) } // Entity2 is the entity ID which contains the other body to joint, the first body being in this entity Entity2 - Box2D/Body component { Body => (body parameters) } There are exactly the same problems that in the third solution, the only difference is that we can have two differents joints by entity instead of one (by putting one joint component in an entity and another joint component in another entity, each joint referencing to the other entity). 5) Having a Box2D/Joint component which take in parameter the two entities ID which contains the bodies to joint, this component can be inserted in any entity, like in this example : Entity1 - Box2D/Body component { Body => (body parameters) } Entity2 - Box2D/Body component { Body => (body parameters) } Entity3 - Box2D/Joint component { Joint => (Body1 => Entity1, Body2 => Entity2, others parameters of joint) } // Entity1 is the ID of the entity which have the first body to joint and Entity2 is the ID of the entity which have the second body to joint (This component can be in any entity, that doesn't matter) With this solution, we fix the problem of the body limitation by joint, we can only have two bodies per joint, which is correct. And we are not limited by number of joints per body, because we can create an another Box2D/Joint component, referencing to Entity1 and Entity2 and put this component in a new entity. The problem of this solution is : What happens if we change the Body1 or Body2 parameter of Joint component at runtime ? We need to add code to sync the Body1/Body2 parameters changes with the real joint object. 6) Same as solution 3 but in a better way : Having a Box2D/Joint component Box2D/Joint which is inserted in the entities which contains the bodies to joint, we share the same joint component between these entities BUT the difference is that we create a new entity to link the body component with the joint component, like in this example : Entity1 - Box2D/Body component { Body => (body parameters) } // Shared, same as in Entity3 Entity2 - Box2D/Body component { Body => (body parameters) } // Shared, same as in Entity4 Entity3 - Box2D/Body component { Body => (body parameters) } // Shared, same as in Entity1 - Box2D/Joint component { Joint => (joint parameters) } // Shared, same as in Entity4 Entity4 - Box2D/Body component { Body => (body parameters) } // Shared, same as in Entity2 - Box2D/Joint component { Joint => (joint parameters) } // Shared, same as in Entity3 With this solution, we fix the second problem of the solution 3, because we can create an Entity5 which will have the shared body component of Entity1 and an another joint component so we are no longer limited in the joint number per body. But the first problem of solution 3 remains, because we can't limit the number of entities which have the shared joint component. To resolve this problem, we can add a way to limit the number of share of a component, so for the Joint component, we limit the number of share to 2, because we can only joint 2 bodies per joint. This solution would be perfect because there is no need to add code to sync changes like in the solution 5 because we are notified by the entity components system when components / entities are added to/removed from the system. But there is a conception problem : How to know easily and quickly between which bodies the joint operates ? Because, there is no way to find easily an entity with a component instance. My question is : Which solution is the best ? Is there any other better solutions ? Sorry for the long text and my bad english.

    Read the article

  • Cocos2d Box2d how to shoot an object inside the screen

    - by Ahoura Ghotbi
    I have the code below : - (id) initWithGame:(mainGame*)game { if ((self = [super init])) { isTouchEnabled_ = YES; self.game = game; CGSize size = [[CCDirector sharedDirector] winSize]; screenH = size.height; screenW = size.width; character = [CCSprite spriteWithFile:@"o.png"]; character.position = ccp( size.width /2 , size.height/2 ); character.contentSize = CGSizeMake(72, 79); [self addChild:character z:10 tag:1]; _body = NULL; _radius = 14.0f; // Create ball body and shape b2BodyDef ballBodyDef; ballBodyDef.type = b2_dynamicBody; ballBodyDef.position.Set(100/PTM_RATIO, 100/PTM_RATIO); ballBodyDef.userData = character; _body = _game.world->CreateBody(&ballBodyDef); b2CircleShape circle; circle.m_radius = 26.0/PTM_RATIO; b2FixtureDef ballShapeDef; ballShapeDef.shape = &circle; ballShapeDef.density = 1.0f; ballShapeDef.friction = 0.2f; ballShapeDef.restitution = 0.8f; _body->CreateFixture(&ballShapeDef); [self schedule:@selector(gameChecker:)]; [self schedule:@selector(tick:)]; } return self; } - (void)gameChecker:(ccTime) dt{ if(character.position.y > 200){ [self unschedule:@selector(tick:)]; [self schedule:@selector(dropObject:)]; } } - (void)tick:(ccTime) dt { b2Vec2 force; force.Set(_body->GetLinearVelocity().x, _body->GetLinearVelocity().y+1.0f); for (b2Body* b = _game.world->GetBodyList(); b; b = b->GetNext()) { if (b->GetUserData() == character) { b->SetLinearVelocity(force); } } _game.world->Step(dt, 10, 10); for(b2Body *b = _game.world->GetBodyList(); b; b=b->GetNext()) { if (b->GetUserData() != NULL) { CCSprite *ballData = (CCSprite *)b->GetUserData(); ballData.position = ccp(b->GetPosition().x * PTM_RATIO, b->GetPosition().y * PTM_RATIO); ballData.rotation = -1 * CC_RADIANS_TO_DEGREES(b->GetAngle()); } } } -(void)dropObject:(ccTime) dt{ b2Vec2 force; force.Set(_body->GetLinearVelocity().x, _body->GetLinearVelocity().y-1.0f); for (b2Body* b = _game.world->GetBodyList(); b; b = b->GetNext()) { if (b->GetUserData() == character) { b->SetLinearVelocity(force); } } _game.world->Step(dt, 10, 10); for(b2Body *b = _game.world->GetBodyList(); b; b=b->GetNext()) { if (b->GetUserData() != NULL) { CCSprite *ballData = (CCSprite *)b->GetUserData(); ballData.position = ccp(b->GetPosition().x * PTM_RATIO, b->GetPosition().y * PTM_RATIO); ballData.rotation = -1 * CC_RADIANS_TO_DEGREES(b->GetAngle()); } } } I have been trying to get the effect that fruit ninja has when shooting the fruits. but it seems like its hard to get such animation so I was wondering if anyone can point me to the right direction and/or give me a sample code for a single object that gets thrown into the screen with a direction.

    Read the article

  • how can i move static box2d object.

    - by user5198
    how can i move static box2d sprites. i have tried this tutorial from . http://www.raywenderlich.com/475/how-to-create-a-simple-breakout-game-with-box2d-and-cocos2d-tutorial-part-12. I managed to add another "paddle" object with box2d body, but i can seam to be able to make the code to move the second "paddle" body. Can anyone direct me how to do it? Is there a way to move a "b2_staticBody" box 2d object? i have tried, but i can only move it when i use "b2_dynamicBody" if i used "b2_staticBody" i can move it at all.

    Read the article

  • Physics in carrom like game using cocos2d + Box2D

    - by Raj
    I am working on carrom like game using cocos2d + Box2D. I set world gravity(0,0), want gravity in z-axis. I set following values for coin and striker body: Coin body (circle with radius - 15/PTM_RATIO): density = 20.0f; friction = 0.4f; restitution = 0.6f; Striker body (circle with radius - 15/PTM_RATIO): density = 25.0f; friction = 0.6f; restitution = 0.3f; Output is not smooth. When I apply ApplyLinearImpulse(force,position) the coin movement looks like floating in the air - takes too much time to stop. What values for coin and striker make it look like real carrom?

    Read the article

  • Simple 2D Flight Physics with Box2D

    - by MarkPowell
    I'm trying to build a simple side scroller with an airplane being the player. As such, I want to build simple flight controls with simple but realistic-feeling physics. I'm making use of cocos2D and Box2D. I have a basic system working, but just can't get the physics feeling correct. I am applying force to the plane (which is a b2CircleShape) based on the user's input. So, basically, if the user pushes up, body_->ApplyForce(b2Vec2(10,30), body_->GetPosition()) is called. Similarly, for down -30 is used. This works and the plane flys along with up/down causing it to dive or climb. But it just doesn't feel right. There is no slowdown on climbs, nor speed up during dives. My simple solution is far to simple. How can I get a better feel for a plane climbing/diving? Thanks!

    Read the article

  • iPhone 4 vs iPhone 3GS Comparison – Graphical Chart

    - by Gopinath
    600000 people pre-ordered iPhone 4 on a single day and this rush of fan boys left both Apple and AT & T web servers down for many hours. If you wonder why so many people are rushing for iPhone 4, here is the chart that explains the difference between iPhone 3GS and iPhone 4. As Steve Jobs said at WWDC 2010, iPhone 4 is definitely going to change smart phone game all over again. via Join us on Facebook to read all our stories right inside your Facebook news feed.

    Read the article

  • box2D simulation doesn't work

    - by shadow_of__soul
    has been a while since last time i used box2D, and i needed to make some stuff, and i saw that my simulation don't worked (compiles, but do anything). i haven't been able to even have working the examples or this simple example i'm pasting below: package { import flash.display.Sprite; import flash.events.Event; import Box2D.Common.Math.b2Vec2; import Box2D.Dynamics.b2World; import Box2D.Dynamics.b2BodyDef; import Box2D.Dynamics.b2Body; import Box2D.Collision.Shapes.b2CircleShape; import Box2D.Dynamics.b2Fixture; import Box2D.Dynamics.b2FixtureDef; import org.flashdevelop.utils.FlashConnect; import flash.events.TimerEvent; import flash.utils.Timer; public class Main extends Sprite { public var world:b2World; public var wheelBody:b2Body; public var stepTimer:Timer; public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); var gravity:b2Vec2 = new b2Vec2(0, 10); world = new b2World(gravity, true); var wheelBodyDef:b2BodyDef = new b2BodyDef(); wheelBodyDef.type = b2Body.b2_dynamicBody; wheelBody = world.CreateBody(wheelBodyDef); var circleShape:b2CircleShape = new b2CircleShape(5); var wheelFixtureDef:b2FixtureDef = new b2FixtureDef(); wheelFixtureDef.shape = circleShape; var wheelFixture:b2Fixture = wheelBody.CreateFixture(wheelFixtureDef); stepTimer = new Timer(0.025 * 1000); stepTimer.addEventListener(TimerEvent.TIMER, onTick); FlashConnect.trace(wheelBody.GetPosition().x, wheelBody.GetPosition().y); stepTimer.start(); // entry point } private function onTick(a_event:TimerEvent):void { world.Step(0.025, 10, 10); FlashConnect.trace(wheelBody.GetPosition().x, wheelBody.GetPosition().y); } } } on this, the object should fall down, but the positions reported me by the trace method, are always 0. so is not a display problem, that i see everything freeze, is why the simulation is not working, and i have no idea why :( can anyone point me to the right direction of where i need to look for the problem? my settings are: windows 7 flashdevelop 4.2.1 SDK: 4.6.0 compiling for flash 10, but i tried every target i have available (till flash 11.5) project set at 30fps

    Read the article

  • Only Integrating Box2D collision detection in my 2d engine?

    - by Mr.Gando
    I have integrated box2d in my engine, ( Debug Draw, etc. ) and with a world I can throw in some 2d squares/rectangles etc. I saw this post, where the user is basically not using a world for collision detection, however the user doesn't explain anything about how he's using the manifold (b2Manifold), etc. Another post, is in the cocos2d forum, ( scroll down to the user Lam in the third reply ) Could anyone help me a bit with this?, basically want to add collision detection without the need of using b2World ,etc etc. Thanks a lot!

    Read the article

  • Cocos2d Box2d contact listener call different method in collided object

    - by roma86
    I have the building object, wen it hit with other, i want to call some method inside it. Building.mm -(void)printTest { NSLog(@"printTest method work correctly"); } in my ContactListener i trying to call it so: ContactListener.mm #import "ContactListener.h" #import "Building.h" void ContactListener::BeginContact(b2Contact* contact) { b2Body* bodyA = contact->GetFixtureA()->GetBody(); b2Body* bodyB = contact->GetFixtureB()->GetBody(); Building *buildA = (Building *)bodyA->GetUserData(); Building *buildB = (Building *)bodyB->GetUserData(); if (buildB.tag == 1) { NSLog(@"tag == 1"); } if (buildA.tag == 2) { NSLog(@"tag == 2"); [buildA printTest]; } } NSLog(@"tag == 2"); work correctly, but [buildA printTest]; get error Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CCSprite printTest]: unrecognized selector sent to instance 0x18595f0' Obviously I'm referring to the wrong object. How i can get different method and property in contacted objects from contactlistener class? Thanks.

    Read the article

  • Confusing box2d forces

    - by Diken
    Hello Friends. This is my demo game screen-shoot. Here i am using three buttons. Right-bottom button is used for jump and left-bottom buttons used for move left and right. I have some questions 1) should i use linearImpuls for jump body?? 2) For move right and left which types of force i applied??? PLease tell me i am confusing to use linearImpuls, applyforce and linearVelocity. Thanks in advance

    Read the article

  • EXC_BAD_ACCESS error when box2d joint is destroyed

    - by colilo
    When I destroy the weldJoint in the update method (see below) I get an EXC_BAD_ACCESS error pointing to the line world->DestroyJoint(weldJoint); in the update method below: -(void) update: (ccTime) dt { int32 velocityIterations = 8; int32 positionIterations = 1; // Instruct the world to perform a single step of simulation. It is // generally best to keep the time step and iterations fixed. world->Step(dt, velocityIterations, positionIterations); // using the iterator pos over the set std::set<BodyPair *>::iterator pos; for(pos = bodiesForJoints.begin(); pos != bodiesForJoints.end(); ++pos) { b2WeldJointDef weldJointDef; BodyPair *bodyPair = *pos; b2Body *bodyA = bodyPair->bodyA; b2Body *bodyB = bodyPair->bodyB; weldJointDef.Initialize(bodyA, bodyB, bodyA->GetWorldCenter()); weldJointDef.collideConnected = false; weldJoint = (b2WeldJoint*) world->CreateJoint(&weldJointDef); // Free the structure we allocated earlier. free(bodyPair); // Remove the entry from the set. bodiesForJoints.erase(pos); } for(b2Body *b = world->GetBodyList(); b; b=b->GetNext()) { if (b->GetUserData() != NULL) { CCSprite *mainSprite = (CCSprite*)b->GetUserData(); if (mainSprite.tag == 1) { mainSprite.position = CGPointMake( b->GetPosition().x * PTM_RATIO, b->GetPosition().y * PTM_RATIO); CGPoint mainSpritePosition = mainSprite.position; if (mainSprite.isMoved) { world->DestroyJoint(weldJoint); } } } } } In the HelloWorldLayer.h I set the weldJoint with the assign property. Am I destroying the joint in the wrong way? I would really appreciate any help. Thanks

    Read the article

  • How to set the position of a sprite within a box2d body?

    - by Frank
    Basically I have 2 polygons for my body. When I add a sprite for userData, the position of the texture isn't where I want it to be. What I want to do is adjust the position of the texture within the body. Here's the code sample of where I am setting this: CCSpriteSheet *sheet = (CCSpriteSheet*) [self getChildByTag:kTagSpriteSheet]; CCSprite *pigeonSprite = [CCSprite spriteWithSpriteSheet:sheet rect:CGRectMake(0,0,40,32)]; [sheet addChild:pigeonSprite z:0 tag:kPigeonSprite]; pigeonSprite.position = ccp( p.x, p.y); bodyDef.position.Set(p.x/PTM_RATIO, p.y/PTM_RATIO); bodyDef.userData = sprite; b2Body *body = world->CreateBody(&bodyDef); b2CircleShape dynamicCircle; dynamicCircle.m_radius = .25f; dynamicCircle.m_p.Set(0.0f, 1.0f); // Define the dynamic body fixture. b2FixtureDef circleDef; circleDef.shape = &dynamicCircle; circleDef.density = 1.0f; circleDef.friction = 0.3f; body->CreateFixture(&circleDef); b2Vec2 vertices[3]; vertices[0].Set(-0.5f, 0.0f); vertices[1].Set(0.5f, 0.0f); vertices[2].Set(0.0f, 1.0f); b2PolygonShape triangle; triangle.Set(vertices, 3); b2FixtureDef triangleDef1; triangleDef1.shape = &triangle; triangleDef1.density = 1.0f; triangleDef1.friction = 0.3f; body->CreateFixture(&triangleDef1);

    Read the article

  • iphone - direct link to iPhone review form from inside iphone

    - by Mike
    I am trying to link directly to the review link of one of my Apps. I know that it is possible because Appirater did it in the past, but some change in iTunes turned the API down. Appirater uses this URL NSString *templateReviewURL = @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=APP_ID&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software"; where APP_ID is the ID of an application. running this from inside the APP gives me the message Cannot Connect to iTunes Store. This Page talks about another kind of link https://userpub.itunes.apple.com/WebObjects/MZUserPublishing.woa/wa/addUserReview?id=APP_ID&type=Purple+Software and also itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID The first one works, but just from the desktop mac. The second gives me the same error as the first... Cannot Connect to iTunes Store. iTunes link maker is not helping too, because it has no tools for iPad links... Do you guys know how to link to an app's review form from inside an app? In case you don't know, what kind of package should I use to dig this? a package sniffer? thanks for any help.

    Read the article

  • Determinism in multiplayer simulation with Box2D, and single computer

    - by Jake
    I wrote a small test car driving multiplayer game with Box2D using TCP server-client communcations. I ran 1 instance of server.exe and 2 instance of client.exe on the same machine that I code and compile the executables. I type inputs (WASD for a simple car movement) into one of the 2 clients and I can get both clients to update the simulation. There are 2 cars in the simulation. As long as the cars do not collide, I get the same identical output on both client.exe. I can run the car(s) around for as long as I could they still update the same. However, if I start to collide the cars, very quickly they go out of sync. My tools: Windows 7, C++, MSVS 2010, Box2D, freeGlut. My Psuedocode: // client.exe void timer(int value) { tcpServer.send(my_inputs); foreach(i = player including myself) inputs[i] = tcpServer.receive(); foreach(i = player including myself) players[i].process(inputs[i]); myb2World.step(33, 8, 6); // Box2D world step simulation foreach(i = player including myself) renderer.render(player[i]); glutTimerFunc(33, timer, 0); } // server.exe void serviceloop { while(all clients alive) { foreach(c = clients) tcpClients[c].receive(&inputs[c]); // send input of each client to all clients foreach(source = clients) { foreach(dest = clients) { tcpClients[dest].send(inputs[source]); } } } } I have read all over the internet and SE the following claims (paraphrased): Box2D is deterministic as long as floating point architecture/implementation is the same. (For any deterministic engine) Determinism is gauranteed if playback of recorded inputs is on the same machine with exe compiled using same compiler and machine. Additionally my server.exe and client.exe gameloop is single thread with blocking socket calls and fixed time step. Question: Can anyone explain what I did wrong to get different Box2D output?

    Read the article

  • AS3: StageWidth for BOX2D?

    - by Gabriel Meono
    I know BOX2D uses meters, and AS3 uses pixels. I'm trying to create objects which are limited to the stageWidth. If I do this variable: for (var i:int = 0; i<(stage.stageWidth); i++){...} The animation will freeze, and this output appears: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Box2D.Collision::b2BroadPhase/CreateProxy() at Box2D.Collision.Shapes::b2Shape/CreateProxy() at Box2D.Dynamics::b2Body/CreateShape() at com.actionsnippet.qbox.objects::CircleObject/build() at com.actionsnippet.qbox::QuickObject/init() at com.actionsnippet.qbox::QuickObject() at com.actionsnippet.qbox.objects::CircleObject() at com.actionsnippet.qbox::QuickBox2D/create() at com.actionsnippet.qbox::QuickBox2D/addCircle() at BOX2D_Test_Tutorial_fla::MainTimeline/frame1() Does anyone know how to fix this? Full Code: [SWF(width = 350, height = 600, frameRate = 60)] import com.actionsnippet.qbox.*; var sim:QuickBox2D = new QuickBox2D(this); sim.createStageWalls(); // make a heavy circle sim.addCircle({x:3, y:3, radius:0.4, density:1}); // create a few platforms // make pins for (var i:int = 0; i<(stage.stageWidth); i++){ //End sim.addCircle({x:1 + i * 1.5, y:18, radius:0.1, density:0}); sim.addCircle({x:2 + i * 1.5, y:17, radius:0.1, density:0}); sim.addCircle({x:1 + i * 1.5, y:16, radius:0.1, density:0}); sim.addCircle({x:2 + i * 1.5, y:15, radius:0.1, density:0}); //Mid end sim.addCircle({x:0 + i * 2, y:14, radius:0.1, density:0}); sim.addCircle({x:0 + i * 2, y:13, radius:0.1, density:0}); sim.addCircle({x:0 + i * 2, y:12, radius:0.1, density:0}); sim.addCircle({x:0 + i * 2, y:11, radius:0.1, density:0}); sim.addCircle({x:0 + i * 2, y:10, radius:0.1, density:0}); } sim.start(); sim.mouseDrag();

    Read the article

  • Are there any alternative JS ports of Box2D?

    - by Petteri Hietavirta
    I have been thinking about creating a top down 2D car game for HTML5. For my first game I wrote the physics and collisions my self but for this one I would like to use some ready made library. I found out Box2D and its JS port. http://box2d-js.sourceforge.net It seems to be quite old port, made in 2008. Is it lacking many features of current Box2D or does it have major issues with it? And are there any alternatives for it?

    Read the article

  • Check for bodies within a specific circle in Box2D

    - by ltjax
    I'm trying to find positions to insert new bodies into my world. For that, I'd like to have a "free" spot where this body wouldn't overlap with anything else. So my plan was to sample "random" positions and check whether they overlap with my "potential" new body. Since my bodies are always circular, I'd need to test within a given circle. So far, the only way to use box2d for this seems to use b2World::QueryAABB around my circle and manually doing an overlap test with all the fixtures it gives me (Box2D doesn't event seem to allow me to tap into its overlapping tests?!). It seems to me like Box2D should already provide such functionality - is there a way that lets me do this without reinventing most of the wheel again?

    Read the article

  • Are there any alternative JS ports of Box2D?

    - by Petteri Hietavirta
    I have been thinking about creating a top down 2D car game for HTML5. For my first game I wrote the physics and collisions my self but for this one I would like to use some ready made library. I found out Box2D and its JS port. http://box2d-js.sourceforge.net It seems to be quite old port, made in 2008. Is it lacking many features of current Box2D or does it have major issues with it? And are there any alternatives for it?

    Read the article

  • cocos2d: syncing CCAnimation frames with Box2d Shape manipulations

    - by Hezi Cohen
    hi everybody! my cocos2d game currently has a ccsprite attached to a box2d body. during the game i apply different CCAnimations on my sprite, i would like to perform certain manipulations to the box2d body according to the frame currently displayed by the sprite (change rotation of the body, etc.) my current idea on implementing this is to subclass ccsprite and change the setDisplayFrame implementation but i thought somebody here probably did the same and already has a solution, so any suggestions on how to implement this? thanks!

    Read the article

  • Box2D networking

    - by spacevillain
    I am trying to make a simple sync between two box2d rooms, where you can drag boxes using the mouse. So every time player clicks (and holds the mousedown) a box, I try send joint parameters to server, and server sends them to other clients. When mouseup occurs, I send command to delete joint. The problem is that sync breaks too often. Is my way radically wrong, or it just needs some tweaks? http://www.youtube.com/watch?v=eTN2Gwj6_Lc Source code https://github.com/agentcooper/Box2d-networking

    Read the article

  • Box2D relations

    - by Valentino Ru
    As far as I know, the unit in Box2D is meters. When I use Box2D in Processing with JBox2D, I set the "world size" as the window size specified in the setup(). Now I'm wondering if there is any function that scales down the world. For example, how can I simulate the throw of tennis ball within a room, without using a window of only 5 x 5 pixels? Additionally, is there any good documentation like the Java API?

    Read the article

  • Apple iPhone 4S Launch In India On Nov 25

    - by Gopinath
    Aircel, one of the leading wireless mobile services provider of India has just announced that iPhone 4S will be available to its customers on November 25. You can start pre-booking the phone from November 18 through Aircel website or walking into an Aircel showroom near you. My multiple calls to Aircel customer care division were no use to get the details on the price information. Three times the call got disconnected before a customer care executive tried fetching the details on price and models. We hear from BGR India blog that iPhone 4S price is going start at Rs. 40,000 for a 16GB model and may go up to Rs. 50,000 for a 64 GB model. Airtel, another leading mobile service provider in India, who sells iPhone in India is not sure when they are going to start offering iPhone 4S to its customer. I reached customer care regarding the iPhone 4S and they don’t have any details to offer at the moment. It’s good to see Apple releasing iPhone 4S to India markets just after couple of months of International release. Apple was earlier criticized for releasing iPhone 2, iPhone 3G in India almost an year after the international launch while companies like Nokia release their flagship models just after weeks of international launch. One of the most sought after feature of iPhone 4S is Siri and my friends in US told that it works amazingly good. Siri does not have any problem in understanding Indian English accent and it is very good at recognizing the Indian names in contacts list. But at the same time we do hear reports that Siri does not help much if it’s used outside USA. Considering that Siri is a software it should be possible for Apple to improve it to work better outside USA. But who know the priorities of Apple! This article titled,Apple iPhone 4S Launch In India On Nov 25, was originally published at Tech Dreams. Grab our rss feed or fan us on Facebook to get updates from us.

    Read the article

  • iPhone 4S Post Paid Rental Plans From Airtel & Aircel [India]

    - by Gopinath
    Apple iPhone 4S is available from Airtel and Aircel cellular operators with mind blowing price tags close to Rs. 50,000/-. If you are a fan boy and ready to buy iPhone 4S here are the details of monthly tariffs offered by Airtel & Aircel. Airtel iPhone 4S Post Paid Plans Airtel has a range of post plans for iPhone 4S lovers. Irrespective of the model of iPhone 4S you are planning to buy they offer post paid plans starting from Rs. 300 per month(after 50% discount on original rental of Rs.600 ) with 200 MB free 3G data to Rs. 1000 with 3072 MB free 3G data. The following table runs down complete details of various plans in offer. For pre-paid iPhone 4S tariffs please check this iPhone 4S Airtel website Aircel iPhone 4S Post Paid Plans Aircel has an unique plan for it’s iPhone 4S customers depending on the model they are willing to buy. For some reason the post paid plans are closely tied with the model of the phone and I believe this is not the right thing for its customers. The plan for 16 GB model costs Rs. 900 for 32 GB model that monthly plan costs Rs. 1150.  Like Airtel these monthly rentals are after 50% discount. This article titled,iPhone 4S Post Paid Rental Plans From Airtel & Aircel [India], was originally published at Tech Dreams. Grab our rss feed or fan us on Facebook to get updates from us.

    Read the article

  • Cocos2d+pybox2d vs Cocos2d-Iphone

    - by DraskyVanderhoff
    I'm now working with two guys for making our first pc indie game and we decide to use cocos2d+pybox2d ( yeah , 2d python game :) ). We decide this based on what i seen in cocos2d iphone games , but i don't get very clear if cocos2d-iphone is just a porting with just a little more features or is far more better than cocos2d for pc. If you can get me out of this dilemma it would be great. I just want to be sure that i'm on the right track ( and also i want to porting this game for android and iphone if it got success in pc , but first my lovely pc :P ) PD: For the maps we will use Tiled , so is totally compatible with cocos2d ( any of both cases i think... )

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >