Jump to content

Search the Community

Showing results for tags 'constraint'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 6 results

  1. Hi everybody: In order to implement with BJS a kind of joystick behavior simulation, that is a cylinder-like object which remains always fixed in one of its endings, and is free (draggable) in the other one, I'm doubting about what could be the best approach: to do all the thing with basic BJS maths; to use a transparent constraint-like sphere, with a radius equal to the length of the stick, so I can detect the picking intersection with the sphere and to orientate the stick accordingly (longitudinal axis) as I dragging it; to use a physics-engine, maybe with a distance Joint (is this an overkill?). Any help?
  2. Hello all and thanks ahead of time for any help. This example has a block you move around with the arrow keys and it bumps into other objects: https://phaser.io/examples/v2/p2-physics/contact-events I am trying to make the block draggable by a mouse (or touch). I added this code to create() to create a transparent copy of the box (for visualization/testing purposes, this sprite would eventually be invisible) input_body = game.add.sprite(500, 200, 'block'); game.physics.p2.enable(input_body, false); input_body.body.setCollisionGroup( game.physics.p2.createCollisionGroup() ); input_body.alpha = 0.5; And then I added this code to update() to make my transparent box follow the mouse point, or last touch point input_body.body.x = game.input.x; input_body.body.y = game.input.y; And then I added this code to update() to make the block follow my mouse on drag. if (game.input.activePointer.isDown) { if (constraint_count == 0) { input_constraint = game.physics.p2.createLockConstraint(input_body, block.body); constraint_count = 1; } else if (constraint_count == 1) { game.physics.p2.removeConstraint(input_constraint); constraint_count = 0; } } else { if (constraint_count == 1) { game.physics.p2.removeConstraint(input_constraint); } constraint_count = 0; } And it works!!...but what happens is my mouse pointer and my transparent block (input_body) get out of sync. And the input_body ends up sort of halfway between the block and the mouse pointer. Letting go of the mouse (which removes the constraint) leaves the input_body at the same offset from the mouse pointer. Once I click, it never lines up again. I'm guessing I'm missing something with the LockConstraint, and the block is acting like an achor weighing down my drag. But I'm not sure how to fix it. Thanks for any and all help!
  3. Hi folks, I need help! How can I remove a constraint?! I have: game.physics.p2.createRevoluteConstraint(nearest, [0,0], newRect2, [0,0], maxForce); Later, in the code, I need to destroy the layer, but before to do that, I need to remove the constraint!
  4. How can i put limits for rotation angle of two objects which connected by "Constraint"? I'm using: game.physics.p2.createRevoluteConstraint(object_A, [0, -20], object_B, [0, 20], maxForce); these object can make rotation 360 degrees - it's not suitable! We should put rotation angle from 0 to 90 degrees. How can we make it?
  5. Hello, I would like to know if it is possible to visually debug constraints when using P2JS (springs, revoluteconstraints, distanceconstraints, etc.) I found this image of box2d debug to illustrate what I mean Thanks in advance for any advice!
  6. Hey guys, Was just wondering if anyone has worked out a way to constrain multiple sprites together using the Arcade engine in a similar way to the P2 method? I'm mainly looking for an equivalent of the lock constraint but I guess any of them would be useful - right now i'm setting the x/y position in the update function and it's got a visible lag - any ideas?
  • Create New...