1 decade ago by SwimDrewid
I'm using impactjs + box2d to make a running game with curved terrain (Thinks Robot Unicorn Attack rather than Canabalt).
I'm looking at using 2x2 collision tiles for the terrain and meticulously tracing the terrain. But this just doesn't feel entirely efficient.
I've figured out that handleMovementTrace() don't play nice with box2d.
I've been through the docs and found a snippet like this:
So, I can detect when the terrain collision tiles slope up, but I'm not certain how to read the ig.game.backgroundMaps[0].getTile
And even then, not entirely certain what I can do with that data.
So, until I figure out a more elegant solution, I'll continue to look at the 2x2 deal.
Any better ideas?
Thanks,
Drew
I'm looking at using 2x2 collision tiles for the terrain and meticulously tracing the terrain. But this just doesn't feel entirely efficient.
I've figured out that handleMovementTrace() don't play nice with box2d.
I've been through the docs and found a snippet like this:
for( var edge = this.body.m_contactList; edge; edge = edge.next ) { var normal = edge.contact.m_manifold.normal; if( normal.x < 0 ) { console.log( '<0',normal.x ); } else if( normal.x > 0 ) { console.log( '>0' ,normal.x); } else { } }
So, I can detect when the terrain collision tiles slope up, but I'm not certain how to read the ig.game.backgroundMaps[0].getTile
And even then, not entirely certain what I can do with that data.
So, until I figure out a more elegant solution, I'll continue to look at the 2x2 deal.
Any better ideas?
Thanks,
Drew