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 folktrash

Looking to bound an entity area of movement. Setting the initial position to vars, and checking against a radius. The thing is - the first time it reports as out-of-bounds, and we flip the direction. The next report is still out of bounds (though it's on it's way back) and so it flips direction again.

The emergent behavior is a "jiggle" right at the radius edge. The default spike entity has this behavior as well. If it has a collision, it works fine, but if it hits the boundary, it is stuck there, switching back and forth.

Is there a "next" position? This must be going on in the collision code, but before I start digging in there, I thought I'd throw it out there.

How do you deal with entity AI and bounding an area of exploration? I see last.x/y but that exhibits the same behavior.

1 decade ago by folktrash

So. Funny story. Imma silly pants. For anyone else who should find themselves silly or pants: Be sure to have
this.parent(res);

before your custom code in
handleMovementTrace();

So yeah. I had made that change in spike.js previously, but didn't notice the problem as it was having a collision before reaching the boundary.

Double so yeah - works like a CHAMP! Back to jamfish.

handleMovementTrace: function( res ) {
this.parent(res);
//custom stuff here
}
Page 1 of 1
« first « previous next › last »