Jump to content

Search the Community

Showing results for tags 'spheres'.

  • 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 1 result

  1. So, I'm sure some of you have heard that I'm working up a web worker and Physics Tutorial... I swear in the end this is gonna be all BJS related... I just gotta get to that point first. Umm Ive kinda ran into a thing that I'm having trouble wrapping my mind around... https://pryme8.github.io/fishsticks/ so I know its glitchy, and I have not told it what to do when both objects have mass that's why it freaks out when the little balls collide... but um how exactly do I get the distance I need to separate my objects after the collision? Core.Test.Circle2Circle = function (a, b, preCalc) { var differenceV = b.position.clone().subtract(a.position); var totalRadius = a.body.radius + b.body.radius; var totalRadiusSq = totalRadius * totalRadius; var distanceSq = differenceV.len2(); if (distanceSq > totalRadiusSq) { return false; } var response = {}; var dist = Math.sqrt(distanceSq); response.a = a; response.b = b; response.overlap = totalRadius - dist; response.overlapN = differenceV.clone().normalize(); response.overlapV = differenceV.clone().scale(response.overlap); response.aInB= a.body.radius <= b.body.radius && dist <= b.body.radius - a.body.radius; response.bInA = b.body.radius <= a.body.radius && dist <= a.body.radius - b.body.radius; return response; } is the function generating the hit results for sphere on sphere action ^_^... umm I have everything I can think of... and tried doing it the way I thought I was supposed to which was take the overlapN and scale it by the overlap... which should give me the amount that the two need to separate... but when I do that the ball makes a HUGE jump off the bottom ball... I scaled the overlap normal by 10 just to see if that would work and it did (for general purposes), but before I start programing in bounciness and friction, was really hoping to get a more accurate separation distance.
×
×
  • Create New...