Jump to content

Search the Community

Showing results for tags 'impulse'.

  • 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 4 results

  1. I'm doing P2 physics collisions with: sprite.body.collides(collisionGroups, callback, this); and I'm trying to get some info on the momentum transfer of the collision to calculate damage, but I can't find the right values. What I've tried is to use the velocity difference like this: var impactSquare = Math.pow(p2BodyA.velocity.x - p2BodyB.velocity.x, 2) + Math.pow(p2BodyA.velocity.y - p2BodyB.velocity.y, 2); This works ok, but obviously it gives totally wrong values when the bodies fly towards each other and just barely touch, then deltaV is pretty high but there is basically no momentum transfer. Since there is no V_old and V_new (as far as I know) to get the change of velocity per sprite (pre and post collision) I've tried to look into using the deltaX values: dx = sprite.previousPosition.x - sprite.position.x ... but stopped there because it feels like an over-complicated and unreliable way to get something that should be somewhere in the data anyway Has anybody an idea where to look? Another (likely over-complicated) idea was to use the onBeginContact method to get the pre-collision velocity and store that somewhere so we can call it in the collides feedback, but ... well feels like there must be something simpler ...
  2. Hi guys, I am wondering how I can remove all the effects of an impulse. I made a playground here(https://playground.babylonjs.com/#9T2J6Z) So there are 2 same boxes, I hit the box1 with the impulse1 first, then I hit both boxes with the impulse2 respectively(I reset position, quaternion, LinearVelocity and angularVelocity before applyImpulse) I expect them to have same track and final position, but seems box1 still have the effects from impulse1, what else do I need to reset to entirely remove the influence form impulse1? and I am curious why the LinearVelocity and angularVelocity is not zero when the box stop on the ground from the dropping?
  3. Hello, How might I apply constant movement using oimo.js such as would occur in an asteroid field - where no object stops moving? That is not the task, but best describes it. By the way I do have borders so the objects are contained. But even if I set no friction and a restitution of 1, no matter how I've tried to apply the impulse, I cannot keep to objects moving. There is no gravity in the scene. Thanks, DB
  4. I have a p2 Object with the following properties this.game.physics.p2.enable(this.player, true); this.player.body.clearShapes(); this.player.body.loadPolygon('playerPolygon','player'); this.player.body.allowRotation = false; this.player.body.fixedRotation = true; this.player.body.immovable = true; this.player.body.setCollisionGroup(playerCollision); this.player.body.collides(ballCollision); this.player.body.kinematic = true; this.player.body.data.shapes[0].sensor = false; this.player.body.collideWorldBounds = true; The above object can only move along its X axis and I want to trigger push/ hit force to its impacting object on collision this.game.physics.p2.enable(this.ball); this.ball.body.setCircle(28); this.ball.body.collideWorldBounds = true; this.ball.body.allowRotation = true; this.ball.body.fixedRotation = false; this.ball.body.adjustCenterOfMass(); this.ball.body.setCollisionGroup(ballCollision); this.ball.body.collides(playerCollision); The above object is always the impacting object whose movement is controlled by gravity and impulse. I'm trying to figure out how to calculate the following:- The point of collision on the body of "this.player" The impulse to apply to the impacting object after collision to simulate a proper/ accurate deflection setting the projected angle and speed/ velocity what properties of the impacting object do I set? Force? AngularVelocity? Velocity?
×
×
  • Create New...