Giter Club home page Giter Club logo

bump's People

Contributors

cruzlutor avatar dmateos avatar hassanshaikley avatar kittykatattack avatar semiterrestrial avatar therealshark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bump's Issues

I think the function 'hit' doesn't work as expect in some cases

  1. The doc says anySprite.circular = true; will make the sprite be interpreted as circular. In fact it doesn't work. I notice there's a block in the source code:
if (aIsASprite && bIsASprite) {
          //Yes, but what kind of sprites?
          if (a.diameter && b.diameter) {
            //They're circles
            return circleVsCircle(a, b);
          } else if (a.diameter && !b.diameter) {
            //The first one is a circle and the second is a rectangle
            return circleVsRectangle(a, b);
          } else {
            //They're rectangles
            return rectangleVsRectangle(a, b);
          }
        }

It seems that the function hit uses diameter as the flag of circle rather than circular. After my testing ,anySprite.diameter= true; works well.

  1. It seems that function movingCircleCollision works well----I mean both the circles move when they hit each other. But rectangleCollision and circleRectangleCollision won't move the second sprite passed into function. Is that a bug?
    P.S. I have passed the correct parameters, the call seems like this: b.hit(circle, rect, true, true);

package.json!

It would be nice if there was a package.json.

In scripts perhaps a npm run build script that would build the source.

Then I (And anyone else) would know how to commit the built source!

And you can also publish to NPM..if you are interested.

Best,

Add rotation support

Would nice to see support for rotated objects (using SAT, swept OOB...) for collision tests, and the colliding angle in collision response.

hitTestCircleRectangle is returning false. (It shouldn't do this)

It can have the value "topLeft", "topMiddle", "topRight", "leftMiddle", "rightMiddle", "bottomLeft", "bottomMiddle", or "bottomRight". If there’s no collision it will be undefined.

Yet half of my collisions are turning up as false. I truly don't have a clue as to why this would be. If there's no collision it should be returning up as "undefined". Either way hit() detects a collision, but when the hitTestCircleRectangle() is run, sometimes I get false.

Any ideas, Maybe this is a bug?

Still maintained?

You mention a new version, when PIXI 4 comes out... which has. Are you still maintaining the lib? Or has Bump2 (https://github.com/LCluber/Bump.js) become the follower?

Would be great if you could mention something in the ReadMe! Thank you!

contain uses mixed positioning

I'm trying to use the contain function to keep a ball (sprite) inside a playing field (container). Struggling to get this done I went into the code to see if I was using it correctly.

Maybe i'm just wrongly interpreting this so correct me if I'm wrong.

Normally x and y are used as anchor positions of the object, let's say for simplicity sake that they indicate the top left corner in this example. The width and height are then used for... width and height. So if you want to know what the x-coordinate is of the right side you do x + width.

In the contain function left and top collision are calculated as if the sprite and the container are on the same level (as if they have the same parent). Because both x's are compared. If the sprite would be in the container then you should just compare sprite.x < 0 (leaving out gravities to make it simpler).

right and bottom are calculated as if they are nested aka as if the sprite is in the container.
Example how it should be for right if they are not nested like in the left and top function: you take the right most pixel sprite.x + sprite.width and you compare it to the right most part of the container container.x + container.width. But in the code it is just compared to the width as if the sprite is inside the container hereby conflicting with the left and top usage.

I'm willing to look into this and fix this if I'm correct.

setup via module system

Hi, sorry for my Eng.
When i try use bump.js via CDN like https://cdn.rawgit.com/kittykatattack/bump/2fe38b76/bin/bump.js
all working correct.
But when i try use webpack or another build system from npm_modules i get error: Bump is undefined...
Builded code don't have 'var Bump ='.

This don't work for me:
let bump = new Bump(PIXI);

app.js:2 Uncaught ReferenceError: Bump is not defined

yarn info bump.js
yarn info v1.5.1
warning package.json: No license field
{ name: 'bump.js',
description: 'A 2D Collision library for Pixi',
'dist-tags':
{ latest: '1.0.3' },
versions:
[ '1.0.0',
'1.0.1',
'1.0.2',
'1.0.3' ],
maintainers:
[ { name: 'happierall',
email: '[email protected]' } ],
time:
{ modified: '2016-10-09T12:35:04.165Z',
created: '2016-10-09T12:12:07.356Z',
'1.0.0': '2016-10-09T12:12:07.356Z',
'1.0.1': '2016-10-09T12:16:08.974Z',
'1.0.2': '2016-10-09T12:23:39.232Z',
'1.0.3': '2016-10-09T12:35:04.165Z' },
homepage: 'https://github.com/kittykatattack/bump#readme',
keywords:
[ 'collision',
'2d',
'pixi' ],
repository:
{ type: 'git',
url: 'git+https://github.com/kittykatattack/bump.git' },
author:
{ name: 'kittykatattack' },
bugs:
{ url: 'https://github.com/kittykatattack/bump/issues' },
license: 'MIT',
readmeFilename: 'README.md',
version: '1.0.3',
main: 'bin/bump.js',
scripts: {},
dist:
{ shasum: 'e0bd953d1ac46d60ab24610d7c632f92295cf8d4',
tarball: 'https://registry.npmjs.org/bump.js/-/bump.js-1.0.3.tgz' },
directories: {} }

error in findCollisionType

Hi everyone,

I think i have found a problem in findCollisionType function.
In findCollisionType to determine if an object is a circle, the existence of diameter member is tested :

[...]
if (a.diameter && b.diameter) {
//They're circles
return circleVsCircle(a, b);
} else if (a.diameter && !b.diameter) {
//The first one is a circle and the second is a rectangle
return circleVsRectangle(a, b);
[...]

But diameter is never added in addCollisionProperties, while the radius is it, so I suggest to use radius instead of diameter, and the code of findCollisionType become :

[...]
if (a.radius && b.radius) {
//They're circles
return circleVsCircle(a, b);
} else if (a.radius && !b.radius) {
//The first one is a circle and the second is a rectangle
return circleVsRectangle(a, b);
[...]

rectangleCollision (and possibly others) seem to break with constant acceleration mechanic

I have a platfomer with a constant acceleration built in to simulate gravity:

let playerGravity = 0.2;
playerSprite.vy += playerGravity;

collision detection for playerSprite and array of sprites that are allowed to collide with the playerSprite:

if( b.hitTestRectangle(playerSprite, collSprites[i])){
b.rectangleCollision(playerSprite, collSprites[i], false);

where:

b = new Bump(PIXI);

on "impact" where playerSprite lands on top of a tile with which it can collide first aligns the playerSprite to the tile, then after ~1 second @ 60fps, the playerSprite disappears. Movement is also hindered after collision to whole tiles before playerSprite disappears.

Polygon collision

AddCollisionProperties doesn't seem to work for polygons. Properties needed for collisions are not valid

License

Hi, I'd like to know what kind of license this library has. I'd like to incorporate it into a project but am unsure if it is open source. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.