Search the Community

Showing results for tags 'physic'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


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

Found 23 results

  1. hi, I have a physic body which should be static on the ground, but I log it's position, and it actually keep changing slightly, why?
  2. Hello guys, So I have two meshes with physicsImpostor, I want them to ignore each other(no collision, just go through), but still behave normally with other physic objects. How can I do that?
  3. Hi Phaser community, It is my first project with Phaser, I am struggling with devicePixelRatio and physics (arcade) body on ipad. When I set the Phaser.Game resolution to 2 (iPad pixel ratio) my sprites are resizing correctly, but the bodies are still positioned as if the resolution was 1. So the body are not positioned on sprites. Does this ring anyone's bell ? How could I match the body position with the sprite position ? Thank you
  4. trying to test syncImpostorWithBone() and syncBoneWithImpostor() functions. I know there is a nice example from , yet I don't know how exactly it works by using my own model. I created a simple 3d model from 3ds max, with a box and a single bone attached, and applied with skin modifier. (as attached image shown) Also, there is no transformation, scaling or any rotation on the bone and box. Then I tried to run my version , I think I am missing something , the loaded model is not syncing properly. could anyone please give me a right direction or fix? much appreciated for any help, thanks
  5. i'm using babylon.js and oimo.js to build a simple scene which has boxes on top of another, there's 7 boxes, and after the scene was build the boxes starts moving and fall, i didn't apply any force and the gravity i'm sure is ok, anyone know what's the reason causing this? and how to stop the moving thanks very very much!
  6. hi, i don't see where is my error with this snippet i want receive a collision between a object who's rotating and another. if a put my "projectile" on "axe" i receive a notification but nothing with the rotation ??? thanks for your help var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload:preload, create: create,update: update }); function preload() { game.load.image('circle', ''); game.load.image('rect', ''); } function create() { this.projectile=game.add.sprite(100,400,'circle') this.projectile.touch=function(){ alert('touch') } this.axe=game.add.sprite(200,200,'rect') this.axe.width=300 this.axe.height=10 game.physics.arcade.enable(this.projectile); game.physics.arcade.enable(this.axe); game.physics.startSystem(Phaser.Physics.ARCADE) } function update(){ this.axe.body.rotation += 1; game.physics.arcade.collide(this.axe,this.projectile,this.projectile.touch,null,this) }
  7. We have a character and a slope on which it costs. How to make that it slid on this slope, being accelerated?
  8. Hi, I've spent the past 2 days stuck on something that should be very simple. I have a sprite representing a ship. I add 10 sprites as child using addChild around the ship. I want to detect an overlap between any of the child sprite and the asteroids. Here is the code used to create the ship: this.player =, this.options.position.y, this.options.sprite); this.player.anchor.set(0.5); this.player.enableBody = true;; Then here is how I add the "sensors" around the ship: var sensors =; for (i=0;i<=9;i++) { var x = (r*Math.cos(360/n*i*Math.PI/180))-(this.player.body.width/4); var y = (r*Math.sin(360/n*i*Math.PI/180))-(this.player.body.height/4); var sensor = sensors.create(x, y, 'ship-sensor'); = 'sensor-'+i;; this.sensors.push(sensor); } this.player.addChild(sensors); Finally, here is how the asteroids are created: this.asteroids =; for (i=0;i<20;i++) { var asteroid = this.asteroids.create(rand_x, rand_y, 'asteroid'); asteroid.body.immovable = true; = 'asteroid-'+i; asteroid.body.mass = -100; } On my update() function, I have:, this.asteroids, function(sensor, asteroid) { console.log("> ", sensor, asteroid ); }, null, this); My goal is to detect an overlap between any of the "sensors" and the asteroids so that I can feed that to a neural network to have a ship that learns to navigate on its own. I tried with Arcade physics, I tried with P2 physics, and I'm about to give up and move on to another game engine at this point... Anybody has a solution to that simple problem?
  9. Hi, Can you please tell me which type of impostors does Oimo.js with Babylon.js support?I use babylon.js and oimo.js I read this instructions here On this page is mention thatthere are 4 impostors:1. Box2. Sphere3. Capsule4. MeshWhich of this 4 impostors are supported in oimo.js ???Which js implement collision oimo.js or babylon.js ??? With Blender I did:I create some simple path and one ball.I set physic collisions and rigid.Path objec has Mesh - collision (Mesh Impostor). In blender animations works fine.I attach file "" I try "" and load "path_example.babylon"Babylon sendbox doesn't work as it works in blender. Does Oimo.js doesn't support Mesh Impostor ? Which file implement Impostor or collision? Do babylon.js implemennt this or oimo.js? Is there any other solution to solve this. I would like to rotate path object (rotate throught all axises x, y, z) at runtime in babylon game engine. It is possible to solve this withouth Mesh-Impostor (Mesh collision shape on Path). I don't want to have static path. I would like to rotate it and I would like to use physic on ball and path objects. Is there any other possible sollution.Can I create colider-boxes around path and join this colider-boxes to one collider-object, because I would liketo rotate all box colliders as one model at runtime (I don't want to have seperated collider-boxes and static path!) Pleas help me. Can give me any advice or hint? Thanx
  10. Hi , I'm back with a new cool experiment. I'm actually porting an open source cpp physic engine library to js/typescript with emscripten/asm.js (it's not not bullet) . I'm on it since 5 days and here is my first result. It sounds promising, So here is a short video preview. Online demo soon ! I hope ... sam A new one : above the 2 first working demo
  11. Make physics time = real time?

    I create a multiplayer game, where i expect that when a body has a velocity of 100px/s, and it moves for 3 (realtime) seconds, that it will have moved ~300px. With arcade and P2 physics, if there is any lag (framerate is not 60fps?), the above is not guaranteed. E.g. after 3 (realtime) seconds, the object only moved ~250px (in some situations). Is it possible to tell the physics system to "catch up", e.g. to do a physicsUpdate(timeSinceLastFrame), instead of physicsUpdate(1/60)?
  12. Hi guys, I'm new here sorry for my grammar in advance So I just recently bought Box2D plugin and after looking at the examples I'm curious what's the best way to create a soft body like the one on (that ripple effect when 2 or more blobs collides each other) ? Right now my best guess is to port the Emanuele's Flash Box2D tutorial from here : Thanks guys
  13. How to disable collision for body

    I want to create the obstacle in my game, which will be moved to the player side, and i want to disable collisions from obstacle's body, because it move my player's body to the left. How can i do it? Help me!
  14. im a beginner in Phaser.js game development and i want to create static body to group , with p2 physic system i created the group and then started the physic system. var block_group =; var Y = 20; for (var i = 0; i < numberOfBlocks; i++) { block_group.create(400,Y,'block'); Y = Y +15; }; game.physics.startSystem(Phaser.Physics.P2JS); block_group.enableBody = true; block_group.physicsBodyType = Phaser.Physics.P2JS; when i print block_group.body it gives me undefined so i tried using forEachAlive and it stile the same however it works fine for single sprite , but with a group it is not working .
  15. Hi! For several months, I have this problem and have not been able to fix it. I made a post about it while communicating my problem. I use physical P2. When the player touches a wall or jump over the side it gets stuck and does not fall as it should. Some of my code: // map ='level1_1');'sand');,; this.layer ='Sand'); // this.layer.debug = true; this.layer.resizeWorld(); this.layer_tiles =, this.layer); // materials & collision groups this.playerMaterial ='player'); this.layerMaterial ='layer'); this.enemyMaterial ='enemy'); this.playerCG =; this.enemyCG =; this.layerCG =; function setupLayer(layer_tiles, theGame) { var layerLength = layer_tiles.length; for (var i = 0; i < layerLength; i++) { layer_tiles[i].setCollisionGroup(theGame.layerCG); layer_tiles[i].collides([theGame.playerCG, theGame.enemyCG]); layer_tiles[i].setMaterial(theGame.layerMaterial); } } setupLayer(this.layer_tiles, this); // player; player.scale.setTo(0.5, 0.5); player.body.setZeroDamping(); player.body.fixedRotation = true; player.anchor.setTo(0.5, 0.5); player.body.collideWorldBounds = true; player.body.setCircle(15); player.body.setCollisionGroup(this.playerCG); player.body.setMaterial(this.playerMaterial); player.body.collides([this.layerCG, this.enemyCG]); player.body.createGroupCallback(this.enemyCG, collisions.collisionEnemy, this); player.body.mass = 50; Can anybody help me? A greeting.
  16. Physic test - Oimo.js

    Hey guys ! I really wanted to try to use Oimo.js with Babylon, so I made a quick test here : (Maybe for a new tutorial, who knows ? ) The thing is: it works reaaally well ! In my scene, I create 1000 spheres, and no problem at all. You can compare with cannon.js here : With cannonjs, i can see a lot of sphere are going through the ground, and the fps is not very high. I may work on the plugin creation if you are interested. Cheers !
  17. Map p2 physic

    How to create it? - red line - polygon. - colorful squares - tile map - random or atlas file. How to set the polygon object I know. Here, too, and plan. How do I randomly impose sprites? What to do to create? To trim down the red line
  18. Reflect body p2

    I turned to reflect sprite. this.obj.scale.setTo(1, -1); How to reflect the polygon body p2 physic? body.setTo(1, -1) not working
  19. Water. Slowdown in P2 physic

    How do I desired deceleration of the object in motion? Suppose when the object is in the water acts on it slowing. I tried to do velocity * 0.99. Slowing down there, but got out a lot of bugs. Now do so:this.obj.rotation = game.physics.arcade.moveToXY(this.obj, this.pointer.x, this.pointer.y, this.speed, 200);How do I make braking object? I've already rummaged
  20. Is there a way in babylonjs/ts to prevent meshes from falling through a map made with GroundFromHeightMap? meshes's physics seems to work only with flat ground tho the camera's gravity recognize height maps so what am' I missing?, in my searches, I've read that it was not support in Babylonjs, If so I would like to know and perhaps try other libraries tho I'm getting use to this one, which is very intuitive and usually find my own way. since my meshes are floating on water, i guess it could be made with shaders but yet to heavy for my understanding so far, any hint to get me started would be appreciated.
  21. HI everyone, I have sprites that have their own trajectory in the world. They have to move like this no matter what happened. But with P2 collision when my player collide with them they are deviated, player move them. I can't make them static because they are moving. I want the player be deviated by them but not the other way round. Is it even possible? And if yes how? Thanks.
  22. Hello, i have a movable platform, right now when the player is on it he move with it but i dont want that, i want him to fall when the platform go away, is there any way to do this ? (I use Phaser v2.0.3) create: function{ // the Player this.player =, 30, 'yellow');, Phaser.Physics.ARCADE); this.player.body.collideWorldBounds = false; this.player.body.setSize(50, 50, 0, 0); this.player.body.gravity.y = 2600; // platform this.platforms =; this.platform = this.platforms.create(0,, 'brick'); this.platform.anchor.setTo(0, 1); this.platform.scale.setTo(30, 1); game.physics.enable(this.platform, Phaser.Physics.ARCADE); this.platform.body.immovable = true; }update: function{, this.platforms); // moving the platform this.platform.body.velocity.x = -500;}if tried to add this : if(this.player.body.touching.down){ this.player.body.velocity.x = 500;}but is very bad because i want the player to stay on the exact same horizontal position all the game and with this he go on the right. any idea ? ps: this is my first post here so i take the opportunity for thank the phaser team ps2: sorry for my english i am not native
  23. Enhanced physics

    Hi, Is there a way to enhance the framework's physics? like if i have a platform who fall on another one, but they touch just a little, I want the falling one to rotate like real gravity collision. For now, it just stop falling and stay horizontal. How can i do this or how can i enhance it (tutorial on how to create a pahser plugin or extension maybe)? Thank you