Search the Community
Showing results for tags 'Revolute'.
-
Hello! I had a look at the forum and couldn't find any advice on this previously (/I don't know the terminology to look up) so I thought I would post and see if anyone could give advice. I am using revolute constraints in my project because I wanted, as you can image, a joint that allows rotation and allows the player to rotate it with keys. The issue is that they are just flopping around the revolution instead of being rigid until the player turns them. I went through the documentation and found other types of constrains, like lock constraints, but they don't seem to work, and I have even tried turning off gravity for the arms to see if that was the issue to no luck. The code for the constraints is below, and I am sure I am missing something obvious so any advice would be great! backConstraint = game.physics.p2.createRevoluteConstraint(player, [-5,-20], backArm, [-20,0.5]); frontConstraint = game.physics.p2.createRevoluteConstraint(player, [-5,-20], frontArm, [-20,0.5]);
-
Hello! I had a look at the forum and couldn't find any advice on this previously (/I don't know the terminology to look up) so I thought I would post and see if anyone could give advice. I am using revolute constraints in my project because I wanted, as you can image, a joint that allows rotation and allows the player to rotate it with keys. The issue is that they are just flopping around the revolution instead of being rigid until the player turns them. I went through the documentation and found other types of constrains, like lock constraints, but they don't seem to work, and I have even tried turning off gravity for the arms to see if that was the issue to no luck. The code for the constraints is below, and I am sure I am missing something obvious so any advice would be great! backConstraint = game.physics.p2.createRevoluteConstraint(player, [-5,-20], backArm, [-20,0.5]); frontConstraint = game.physics.p2.createRevoluteConstraint(player, [-5,-20], frontArm, [-20,0.5]);
-
Hey guys! I'm just starting out with Phaser game programming. I'm trying to build a proof of concept rope system. I for some reason, when I apply gravity, the revolute joint fails. Not sure what to do. Any ideas? Also, I'm running off the dev branch. You can find my demo here: https://dl.dropboxusercontent.com/u/21728452/Games/phaser-master_V2/rope/index.html Thanks! preload: function() { game.load.image('rope_piece', 'assets/rope_piece.png'); }, create: function() { cursors = game.input.keyboard.createCursorKeys(); game.physics.startSystem(Phaser.Physics.P2JS); rope_1 = game.add.sprite(100,100,'rope_piece'); rope_2 = game.add.sprite(100,110,'rope_piece'); game.physics.p2.enable([rope_1]); game.physics.p2.enable([rope_2]); //game.physics.p2.enable([rope_3]); game.physics.p2.gravity.y = 100; //rope_1.body.clearCollision(true, true); //rope_2.body.clearCollision(true, true); //rope_1.body.mass = 0; rope_1.body.data.motionState = 2; //rope_2.body.data.motionState = 1; constraint = game.physics.p2.createRevoluteConstraint(rope_1, [0,-5], rope_2, [0,5]); }, update: function() { if (cursors.up.isDown) { rope_2.body.thrust(50); } else if (cursors.right.isDown) { rope_2.body.rotateRight(5); } //rope_1.body.setZeroVelocity(); },