Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by dlkulp

static collisions (with the world) work as expected but collisions between entities does nothing. Using:
collides: ig.Entity.COLLIDES.ACTIVE,
and
collides: ig.Entity.COLLIDES.PASSIVE,
but neither do anything. There are no errors in the console and everything else appears to be functioning normally. Any thoughts or common places I should check?

1 decade ago by http404error

Codeveloper here. We have a few types of boxes that derive from the following MovingObject. They're intended to collide with one another, but instead ignore dynamic collision entirely. As dlkulp mentioned, static collision is working fine.

My inclination is that we're missing some sort of flag to enable dynamic collision, but I can't find anything in the docs about that.

ig.module(
	'game.entities.MovingObject'
)
.requires(
	'impact.entity'
)
.defines(function () {
    EntityMovingObject = ig.Entity.extend({
        size: { x: 64, y: 64 },

        collides: ig.Entity.COLLIDES.ACTIVE,

        init: function (x, y, settings) {
            this.parent(x, y, settings);
            this.maxVel.x = 800;
            this.maxVel.y = 800;
        },

        update: function () {
            if (ig.input.state('keyUp')) {
                this.accel.x = 0;
                this.accel.y = -500;
            } else if (ig.input.state('keyDown')) {
                this.accel.x = 0;
                this.accel.y = 500;
            } else if (ig.input.state('keyLeft')) {
                this.accel.y = 0;
                this.accel.x = -500;
            } else if (ig.input.state('keyRight')) {
                this.accel.y = 0;
                this.accel.x = 500;
            }

            // move!
            this.parent();
        }
    });


});

1 decade ago by http404error

I believe that the issue has been resolved, although as to be expected, other problems have arisen in its place.

1 decade ago by lTyl

Quote from http404error
Codeveloper here. We have a few types of boxes that derive from the following MovingObject. They're intended to collide with one another, but instead ignore dynamic collision entirely. As dlkulp mentioned, static collision is working fine.

My inclination is that we're missing some sort of flag to enable dynamic collision, but I can't find anything in the docs about that.


You have to make sure you are defining which TYPE of Entity you want Impact to checkAgainst and which entity your current one is. If you do not set the appropriate properties in your entities, it will default to this:

type: 0, // TYPE.NONE
checkAgainst: 0, // TYPE.NONE
collides: 0, // COLLIDES.NEVER

By only setting the collides property, the condition to trigger a collision will never be met for Entity-on-Entity collisions

1 decade ago by http404error

.type only appears to affect the .check() function, not collisions.

Collisions and .collideWith() are working without any setting of .type or .checkAgainst.

As far as I'm concerned, they're two completely distinct systems, connected only by the fact that they both relate to objects overlapping with each other.
Page 1 of 1
« first « previous next › last »