Jump to content

Search the Community

Showing results for tags 'friction'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

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 12 results

  1. Hello, friends! Friction isn't it supposed to stop the ball? Why does he keep moving like nothing's working on him? see here - https://www.babylonjs-playground.com/#BEFOO#228
  2. I'm making a game in phaser 3 using the arcade physics and I want the player to be able to move boxes. The player can move the boxes right now but they are to light. Can I solve this with friction between the boxes and the platforms, and if so how do I do that? Here is my code: platforms = this.physics.add.staticGroup(); platforms.create(180, 588, 'platform3').setScale(0.5).refreshBody(); platforms.create(580, 450, 'platform4').setScale(0.5).refreshBody(); platforms.create(980, 450, 'platform4').setScale(0.5).refreshBody(); platforms.create(1280, 450, 'platform4').setScale(0.5).refreshBody(); boxes = this.physics.add.group({ key: 'box', repeat: 9, setXY: { x: 100, y: 0, stepX: 180 } }); this.physics.add.collider(boxes, platforms); this.physics.add.collider(boxes, boxes);
  3. Hey! This is my first thread, I'm new here, so hello everyone! I started last week with phaser, and I am trying to test some features like extend the world, adding other sprites to background, adding a camera, all of this in the "game" that you make in this tutorial. So now, I want to learn how friction works in platforms or ground. game.physics.startSystem(Phaser.Physics.ARCADE); platforms = game.add.group(); platforms.enableBody = true; var ground = platforms.create(0, game.world.height - 64, 'ground'); ground.scale.setTo(4, 2); ground.body.immovable = true; ground.body.friction.x = 0; I want to set my ground like ice and that the player can slide, but it didn't work and I don't know why. If there is no other code that involves "ground", maybe the problem is with the player sprite? :S The version of phaser i am using is 2.9.4 btw.
  4. I'm using physics in one of my games, but I'm having trouble getting things to move realistically. I have the player (a bird), and I have objects in a group (trash). The trash I want to be very lightweight, so that it can be knocked around by the bird. Setting mass on both the player and the objects sometimes results in some weird visual stuff, so for now I have taken those lines out. What I really want to solve is the issue of friction. Right now, my code looks like this: this.trash.forEach(function (piece) { piece.anchor.setTo(0.5, 1); piece.body.gravity.y = 5; piece.body.moves = true; piece.body.velocity.setTo(100, 100); piece.body.collideWorldBounds = true; piece.body.bounce.set(0.8); piece.body.friction.x = 1; piece.body.drag.x = 1; }); The trash is gliding around on the floor of the game like wet ice cubes. I thought perhaps introducing another sprite to interact with would help: this.platforms = this.add.physicsGroup(); // Create the ground and set properties. this.platforms.create(0, game.height - 5, 'ground'); this.platforms.setAll('body.allowGravity', false); this.platforms.setAll('body.immovable', true); this.platforms.setAll('body.moves', false); this.platforms.setAll('body.velocity.x', 100); this.platforms.setAll('body.friction.x', 1); this.platforms.setAll('body.drag.x', 1); I'm still watching ice-cube trash. What I'm aiming for is something that can tumble (is there a way to get corresponding rotation on collision to happen?), so I want moving the trash to be more of a shove to move a distance rather than a tap from the player. Thank you for your help!
  5. Hi @all, I think I found a bug again. In this PG: http://playground.babylonjs.com/#249T6Y I change friction for a to zero but friction b becomes zero too (See console too) If it is no bug, please tell me how can I change the friction for just a.
  6. Hi @all, I think I found a bug again. In this PG: http://playground.babylonjs.com/#249T6Y Edit: New URL:http://playground.babylonjs.com/#249T6Y I change friction for a to zero but friction b becomes zero too (See console too) If it is no bug, please tell me how can I change the friction for just a.
  7. Hi all. I am trying to make a simple top-down, asteroids-like game, where movement is done through Phaser's arcade physics system. I find quite puzzling how angular movement works for it. I've followed a few tutorials, where I find the same issue. What is happening is, when my ship has an angle, thrusting or reversing is quite inconsistent. The ship appears to be "slipping" a bit in random directions, and does not always follow exactly the direction it's facing. The relevant create code is: player.body.maxVelocity.setTo(MAX_SPEED, MAX_SPEED); player.body.drag.setTo(DRAG, DRAG); whereas the relevant update code is: if (cursors.left.isDown) { player.body.angularVelocity = -ROTATION_SPEED; } else if (cursors.right.isDown) { player.body.angularVelocity = ROTATION_SPEED; } else { player.body.angularVelocity = 0; } if (cursors.up.isDown) { player.body.acceleration.x = Math.cos(player.rotation) * ACCELERATION; player.body.acceleration.y = Math.sin(player.rotation) * ACCELERATION; } else if (cursors.down.isDown) { player.body.acceleration.x = -Math.cos(player.rotation) * ACCELERATION; player.body.acceleration.y = -Math.sin(player.rotation) * ACCELERATION; } else { player.body.acceleration.setTo(0, 0); } I don't understand what could be causing this. Is the code just wrong (although I've seen this happening in all the tutorials)? Is it some rounding error? Am I just being crazy seeing this as wrong behavior? Is there any way to achieve the effect I am looking for (moving diagonally back and forth, on a straight line)? You can play around with this here as well.
  8. Hey guys, first post, started using Babylon Friday, so I may be a little green. I'm done waiting for Unity3D's webgl porting to not be a steaming pile. Really liking everything so far, but I could use some advice on moving forward with an FPS camera. I extended it from the BABYLON.FreeCamera. Nailed down most of it, but realized that the built-in collision the camera uses has no real concept of friction. It's going to be a bit of a problem when I intended on having moving floor platforms. They just slide right out from under you as-is. I'd rather not start from scratch or fall back on TargetCamera because of all the input groundwork that FreeCamera provides. My best guess for moving forward is to dig in and start overriding the collision functions of FreeCamera like _collideWithWorld(), _updatePosition(), etc. and replace them with Oimo compatible logic. I just want to get the problem out there before I go down that rabbit hole. Is this a horrible idea? Or maybe I'm just missing something incredibly obvious about the built-in physics? Thanks in advance for any advice.
  9. Hello, can you please help me? I require non-rotating crates. Like in this oficial example: http://phaser.io/examples/v2/p2-physics/platformer-material , where I add just one line box.body.fixedRotation = true; to the for cycle creating the boxes. Suddenly, they start to shift and slip. I need them to stay still. How can I fix this? Do you have any idea please? I would be very greatful! I have tried using different materials, but notning helps. Friction is just gone
  10. Hi everyone, I am moving forward on my worms project. I have had a problem with P2 physics for a while that I cannot solve and I need to solve it for impact events. THE DEMO: (Chrome Firefox only) THE REPO: THE PROBLEM: On contact with my level (on a hill) my worm keeps sliding veeeery slowly and annoyingly. If the worm is in contact with the level he should stay still (but he won't). ATTEMPTED: Setting the body of the worm properties: velocity.x =0, velocity.y=0, rotation = 0, angle=0, angularDamping =0, angularVelocity = 0, gravityScale = 0.1 (allowGravityScale = true); Setting the game.physics.p2 properties: friction = 1 (tried 0, 1000, 3000 etc), p2.world.defaultContactMaterial.friction = same thing, restitution = 1; CODE OF INTEREST: WORM CLASS - specifically lines 112-117 GAME STATE Thanks in advance for your help!
  11. Hey everyone, I created a tilemap layer and enabled Arcade physics for it and set the friction to 1,0. I also set up collisions and everything. But when my bullets collide with the map, there is no friction applied, they just slide through. Is the friction property supposed to work with Arcade physics at all, because I've only seen topics of friction with the P2 physics. So I'm not sure. ...var map : Phaser.Tilemap = game.add.tilemap('map');map.addTilesetImage('ground_1x1');map.setCollisionBetween(1,12);this.layer = map.createLayer('Tile Layer 1');this.layer.resizeWorld(); game.physics.startSystem(Phaser.Physics.ARCADE);game.physics.arcade.enable(this.layer);this.layer.body.friction.setTo(1,0);...this.bulletGroup = game.add.group();this.bulletGroup.enableBody = true;this.bulletGroup.physicsBodyType = Phaser.Physics.ARCADE;this.bulletGroup.createMultiple(500,'bullet');this.bulletGroup.setAll("anchor.x", 0.5);this.bulletGroup.setAll("anchor.y", 0.5);this.bulletGroup.setAll('outOfBoundsKill', true);this.bulletGroup.setAll('checkWorldBounds', true);this.bulletGroup.setAll('body.mass',0.1);...game.physics.arcade.collide(this.bulletGroup, this.layer, this.bulletCollision);
  12. I am new to Phaser, so definitely a ton I do not know. I was experimenting with it by working on a little game where a player jumps from one platform to another, based on where the user clicks. I did this by setting the velocity of the player's body. However, once it lands on the other platform it just keeps sliding. I looked into the documentation and found a Friction property in Arcade.Body but I am not sure how to use it. I looks like it should be applied to the platform the player lands on, but it seems to require a point, and I have not been able to find an example using it. I did implement a custom friction method using the collisionCallback used by the collide method, that reduces the x velocity incrementally to 0 and results in this behaviour: http://gfycat.com/ZigzagBrownHoopoe Which seems to work fine, but if there is a built in way to set it, I would prefer to use that.
×
×
  • Create New...