Search the Community

Showing results for tags 'box2d'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 104 results

  1. VittorioSL

    Scale Polygon

    Hi all, I've a problem with Phaser and Box2D Physic. I created a game where I load sprites and apply a polygonal body to them through a series of coordinates. When I resize the sprite I send the coordinates to a function that recalculates them based on the scaling factor. The coordinate array returned to me is correct, but when I redraw the body I have the effect shown in the attachment image. In other words, a square is always drawn in the same position and with the same dimensions. The coordinates of the square AREN'T present in my array. I realized that this occurs when there are very close coordinates 'cause if the scaling factor isn't so small the problem doesn't occur. Can someone help me? Thanks in advance, Vittorio
  2. max lancaster

    Collisions with Box2d

    I am using Phaser with Box2d and my system allows the user to enable/disable the properties "passthrough" and "collide with edges" for each body. "Passthrough" = pass through other bodies. "Collide with edges" = react to collisions with the walls. This setup generates 5 categories of bodies: 1 - walls (should collide with bodies of category 2 and 4) 2 - "passthrough" + "collide with edges" (should collide with bodies of category 1) 3 - "passthrough" + "not collide with edges" (should collide with nothing) 4 - "not passthrough" + "collide with edges" (should collide with bodies of category 1, 4 and 5) 5 - "not passthrough" + "not collide with edges" (should collide with bodies of category 4 and 5) I have set up collision filtering to meet these criteria. It works. My issue is that my system does not provide any collision information when one body passes through another. I would like to implement a function isTouching(instanceID) that allows me to determine if a body is touching another body, given their instance IDs. I have tried making these "passthrough" bodies sensors, but that makes them pass through all bodies, including walls. This doesn't work because, for example, bodies of category 2 should still collide with the walls. Any tips are greatly appreciated. Thanks.
  3. Maybe this is an old subject but nowdays I'm trying implementation of box2d/pixijs HTML5 game to mobile. Everything was working okay until android 6+ appeard. Crosswalk was solving most problems but i had new releases and cordova 8.0 , crosswalk, android 7.0 and pixi just give poor performance. Game runs smoothly on desktop, and ok on mobile browser, but Native (cordova) runs @21 fps. Has anyone facing same problems? Is there a easy solution to replace cordova with some other framework ? How do you pack pixijs to Native ? Thanks, 3ojan
  4. Ninja.io is a fast paced, 2D multiplayer shooter inspired by games like Soldat, Unreal Tournament and N-game. Currently implemented game modes include Capture the Flag and Deathmatch. It uses the Box2D physics engine to enable convincing rigid body simulation. Players can make various moves including backflips, rolls, proning, running, flying and crouching. The game is still under active development and I'm willing to devote a great deal of time to finishing this project. I've made a test server available and you can join it by following these steps: - Go to ninja.io - Play as Guest - Enter a username - Join CTF or Deathmatch. - Select primary and/or secondary weapon Press H to display table of controls. Decrease the size of the browser window in case it runs slow. I've noticed that some laptops and older systems have trouble maintaining adequate fps. It is currently not possible to register a username, but I've been making progress on an account and highscore system. The game server is currently located in Europe. I plan on running additional servers on other continents and for the site to serve as a gateway to the nearest game server when players join in order to minimize latency. Any thoughts, feedback or suggestions would be much appreciated! Thanks. Edit - 15-12-2017: New version! Sound effects have finally been added, weapons & items have been updated & tweaked, libraries have been updated and many improvements have been made along with numerous bugfixes. I'm currently finishing the implementation of the account system and I'm working on several new maps. More updates will follow soon!
  5. ArcadixInfotech

    box2d collision filtering with phaser

    Hello, Can anybody please tell me how box2d collision filtering works in JavaScript(box2dweb). I need balls to collide with player but not with other balls. There are example out there but they are in c++ or other language. I am newbie in gaming hence a silly question. Thanks.
  6. ArcadixInfotech

    Texture in box2d rope/distance joint

    Hello, Is it possible to give a texture to box2d's rope or distance joint. I can see the joints in draw debug mode, but need something like an actual rope texture. Thanks
  7. GideonSam

    Box2D FPS drop in Mobiles

    Hi All, I have been developing a box2D game in Phaser 2, it works fine in the Desktop browsers. When comes to the Mobiles the FPS drops. There are only three sprites in the stage, one static body and a dynamic body. Please kindly help. Thanks, Gideon
  8. Made this for the SMU Hack-a-week (St Mary's University, Halifax, Canada) back in May of this year, won the open category with it. Game: http://www.blockshipwars.com/WhiteFish/ Github: https://github.com/chadams77/WhiteFish Development videos: https://www.youtube.com/user/probeapps Development screenshots: http://www.blockshipwars.com/wfscr/ WhiteFish is a physics based fishing game, with rod, line, and fish physics. Three different species of fish, three different rods, and three different lures. You buy better gear by earning money for catching fish, the goal is to enjoy yourself at times when you can't go fishing in RL. Some screenshots taken of the newest version:
  9. studdDev

    Box2D destructible terrain

    Hello there, Is it possible to create destructible terrain in HTML5 and box2d Video examples : Box2d Destructable terrain.mov Box2d Destructable terrain 2.mov Any help in this direction would be much appreciated. Thanks Again
  10. Helpp Me I want te execute my callback function only 1 time. But it won't
  11. Puflo

    Physics bug

    Box2D always calls contact callback twice. Here's an example: 185.50.68.103 Ship with collision category 2 (ship at left) calls contact callback once while ship with collision category 1 (default) calls it twice. I've been trying to fix this for weeks but couldn't find any solution in web, i really need you guys to help me. function create() { game.physics.startSystem(Phaser.Physics.BOX2D); game.stage.backgroundColor = '#2d2d2d'; // User-controlled ship ship1 = game.add.sprite(250, 300, 'ship'); game.physics.box2d.enable(ship1); ship1.body.setCircle(14); // Ship with collision category 2 (triggers contact callback only once, it shouldn't even trigger it) ship2 = game.add.sprite(200, 200, 'ship'); game.physics.box2d.enable(ship2); ship2.body.setCircle(14); ship2.body.setCollisionCategory(2); // Ship with collision category 1 *default, i guess* (triggers contact callback TWICE) ship3 = game.add.sprite(300, 200, 'ship'); game.physics.box2d.enable(ship3); ship3.body.setCircle(14); game.physics.box2d.setBoundsToWorld(true, true, true, true, false); ship1.body.setCategoryContactCallback(1, function(b1,b2,f1,f2,begin){ if (begin){ total += 1; hitText.text = 'Contact callback called '+total+' times'; console.log("CONTACT: ", b2) } }, this); cursors = game.input.keyboard.createCursorKeys(); game.add.text(5, 5, 'Use arrow keys to move.', { fill: '#ffffff', font: '14pt Arial' }); total = 0; hitText = game.add.text(5, 30, 'Contact callback called 0 times', { fill: '#ffffff', font: '14pt Arial' }); } function update() { if (cursors.left.isDown) { ship1.body.rotateLeft(300); } else if (cursors.right.isDown) { ship1.body.rotateRight(300); } else { ship1.body.setZeroRotation(); } if (cursors.up.isDown) { ship1.body.thrust(300); } else if (cursors.down.isDown) { ship1.body.reverse(300); } } function render() { game.debug.box2dWorld(); }
  12. Hi, Completely new to Phaser but love it. I've purchased and am using the Box2D plugin and have a simple question about the coordinate system. If I create a new game with dimensions width 800 and height 600 like so: var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', {preload: preload, create: create, update: update, render: render}); With the following pixels to meter setting: game.physics.box2d.ptmRatio = 100; and create a new Box2D body with a 40 x 20 pixel rectangle fixture (centred on the body) like so: var rect = new Phaser.Physics.Box2D.Body(this.game, null, 400, 0); rect.static = true; rect.addRectangle(40, 20, 20, 10); See the image below: Why is the rectangle not positioned 400 pixels from the left? It looks like it's positioned 200 pixels from the left instead. Is there some scale factor I'm missing here? This is happening on my Retina MacBook Pro and on an external 1920 screen (not Retina). Many thanks in advance,
  13. eddieone

    Box2D Bug?

    Some times when leaving my game open or when one player leaves, I get a cryptic box2d error. Is this a bug? It's v102
  14. Hi, I'm creating a game that player can walk over terrains with lots of slopes. How can I make my player rotate accordingly to the angle of the slope? This is how it's currently working: And this is how is must work (I've changed the angle manually): I'm using Box2D plugin to generate the terrain accordingly to an image. That's the reason of all these bodies. Thanks!!
  15. GideonSam

    Circular Motion & Gravity

    Hi All, I have implemented planatary gravity using the below link http://www.emanueleferonato.com/2015/06/19/simulate-planet-gravity-with-phaser-box2d-as-seen-on-angry-birds-space/ Now i need the object just move over the planet with gravity . How to do it kindly help please ?????????????
  16. I started working on a top down racing game as fun project a while back. I didn't use any game framework. Only node.js, express.js, socket.io and bunch of node modules and webpack. I got a working prototype where I can drive around and get real time sync between players that was good enough for now. The next thing I started on was collision detection. After a while I realised that I need some framework for it rather than create my own thing. After some research I started looking at phaser and finally bought box2d plugin for phaser which included a simple top down racing game as a example. I spent some time on tweaking parameters and got a result I was happy with. So I brought phaser into my project and got problems with pixi.js on the node server because there are no dom elements and pixi seems to be baked into phaser. After some googling it seems like running phaser on the server is a bad idea, but I only wanted box2d anyway. So I got a box2d version called box2dweb and tried to create the same thing that I had working in phaser + box2d. After getting errors I couldn't figure out it turns out after some googling that there is missing functionality (edgeChains) in box2dweb. So I try all the other implementations of box2d in JS that I can find and all of them reports errors (different errors with each version) and it's code that works fine in the box2dweb version. Sigh. I can not be the first person wanting to do a real time multiplayer game using node and box2d. Any advice how to move forward?
  17. Hi I'm working on a top down racing game. Yesterday I decided to buy the box2d plugin for phaser to get collision physics. There is a simple top down racing game included as a tutorial which I tried out and the collision part was good enough for my needs. But the actual driving physics were not because it was more like a spaceship. If you would stop pressing forward the car would continue in current direction until slowed down. But when I turn during this sliding a car should go where the wheels point and not in its current direction like a spaceship. So I decided to add my own driving physics to the demo which makes the car go in the direction of the wheels and instead of activating car.body.thrust(power) on key UP I call my function that ultimately sets car.body.x and car.body.y so it moves correct. The problem is that now I'm not colliding with the walls anymore because the box2d simulation is just getting the coordinates and doesn't move the car any more. I would like to use box2d as much as possible but I couldn't figure out how to make the car not slide like a spaceship and if possible I want to avoid having to create my own collision detection. Any tips on how to approach this?
  18. Thomas Erlandsen

    How to disable distanceJoint box2d Phaser

    hi guys, How can I disable distanceJoint from a created sprite ?? I need to create a game similar to Tower Bloxx, Help Please.
  19. Oana Maria

    Webgl camera in box2d

    Hello! I am new in Webgl programming, and I am having trubel with moving the camera. I try to create a maze game, and I use three.js and box2D.js. The problem is that the camera is looking from above into the mazze, while I am trying to make it part of the maze (I mean looking like you are trying to escape from the maze). Could anyone, please, help me? I haven't found any ideeas on the web....
  20. Hi everyone, I am making a pinball-like game and there can be more than one ball at once. Is it possible to ignore collision between balls and leave it for some other objects? Many thanks.
  21. eddieone

    Strange Flicker with Mobile Canvas

    I have been testing my game on mobile using the chrome remote debugging for Android. With auto/WebGL I was around 48 frames a second. With Canvas close to 59 FPS. Preceived heat was lower as well. One annoying thing is a strange flicker, most notiable on text and buttons. See Gif for example, quality is kinda low, ignore that. Any idea how this could be fixed? It doesn't happen in WebGL
  22. Hi, Does anyone know what can be an issue? I am having a gap on the right and on the bottom with Phaser Box2d.
  23. caymanbruce

    Using Box2D with PIXI.js

    I am using Box2D physics engine with PIXI.js as the renderer. But I have trouble using it correctly. Box2D is based in MKS(Meters, Kilograms and seconds) But Pixi.js renders everything in pixel. So I need to convert from MKS to pixel when I render sprites/movements. I don't know how to do this properly. I have seen some examples saying I just need to convert the positions using a scale factor in PIXI.js (see this https://chrisbranch.co.uk/2014/11/debugging-box2d-with-pixi-js/). But someone also recommend me to just use stage.scale so that everything in the stage will scale to the particular ratio I choose at the beginning. Anyone has similar experience before? How to render Box2D-based sprites nicely using PIXI.js?
  24. jcharry

    Scaling Box2D sprites and world?

    Hello! I'm new to Phaser and Box2D, but I've looked through as many posts as I could find on scaling box2d and am still struggling to get it working well. I'm trying to scale a bunch of sprites, and on each scale step increase the worldsize as well so that I can reset box2d world bounds. I've gotten the world scaling and the sprites scaling, but the physics bodies stay behind. It looks like this: the sprites are beyond the bounds of the world and they are offset from their box2d bodies. Here's what I've tried - using body.setRectangle() to scale the Box2D rectangle as well. I've also noticed that the sprites are scaling faster than the world and are leaving the world bounds. I've been banging my head against the wall for a while and was hoping someone had some wisdom to share. if (this.cursors.up.isDown) { // An internal function that I use to track world scale. This is working fine this.scaleWorld(1); // Scale all the bodies in the world inside a group called stageGroup this.stageGroup.scale.set(this.worldScale); // Set the world scale & reset bounds this.game.world.scale.setTo(this.worldScale); this.game.world.setBounds(0, 0, this.worldSize.width * this.worldScale, this.worldSize.height * this.worldScale); // Reset box2d world bounds this.game.physics.box2d.setBoundsToWorld(); // For all sprites in the sprite group, scale them this.stageGroup.children.forEach(child => { // scale x and y child.position.x = child.position.x * this.worldScale; child.position.y = child.position.y * this.worldScale; // This is what I've tried but it's not working child.body.setRectangle(child.initialSize* this.worldScale, child.initialSize * this.worldScale, 0, 0, 0); }); } Thanks!!
  25. Trying to convert my project over to Box2d in Phaser and having trouble... Can someone please tell me what I'm doing wrong here? Attached is the example file for World Bounds, I have made some small changes to incorporate collision categories and masks. Everything is working as expected except for the world boundaries. I have been over the docs many times and I think I am doing this as described. Notice how all the collisions are working except for world bounds. TIA world boundstest.html