AS3 2.1 Port (Alchemy), WCK Update and Kinematic Demos

Awesome work on this, everything is turning out great so far. I do have a question, though, about edge chains. I've been searching around and can't really find an answer on how I'm supposed to build edge chains now. As far as I can tell, they are no longer in 2.1? I know I need to use polygons with 2 vertices, but I'm not sure how to construct a long "chain" of them. Before it was easy to just specify some points and that was it. Anyone know the best way to approach this now? Thanks.
evilsatan: Do you have the latest version of CS4? There was an issue in CS4 with large projects that was fixed with a free update.

ChocolateCake: No idea, not familiar with FlashDevelop. Maybe its not including the "extras" package or is an issue with the size of the project?

helios02: Just loop through your points and create the chain manually as a bunch of 2 point polygons. The lineArc method of BodyShape does this.
Thank! I installed the update and the whole demo is working now!
First off, I'd like to say great job on this 🙂


Here's my question: I'm using the engine to make a side-scrolling game for school, and I'm using the BoxMan as kind of a starting point for my character. I'm not very good with physics, but I'm trying to find a way to stop him from accelerating in speed when he starts to jump and move forward. The character keeps gaining momentum and I'm trying to find a way to turn this off. I've tried playing around with density, friction, and other variables within the component, but can't seem to figure it out. Could you point me in the right direction?

Thank you!
@bashy
are you saying you don't want your character to be able to accelerate left or right while in the air?
I think you need to fix the typo 'GetManidold' on b2Contact 🙂 Haven't found any other bugs yet.
sketchbookgames...

No that's not what I mean. What I mean is, that when you are strafing left or right, every time you jump you will start gaining speed, and you gain speed each time you jump until you are going insanely fast. I want to eliminate the ability to progressively gain speed with each jump.

Thanks for the reply.
BoxMan was just an example. Threw that together in 2 minutes. Here's a better implementation. "d" is a normal vector pointing where you'd like to move, "inc" is the amount to increase each step, "max" is the maximum velocity allowed, "quickTurn" will allow you to quickly stop and move in the opposite direction. I use this for both ground movement and air "nudge" movement with different parameters.

Code:
      public function applyMoveImpulse(d:V2, quickTurn:Boolean, inc:Number, max:Number):void {
         var lv:V2 = b2body.m_linearVelocity.v2;
         var dot:Number = d.dot(lv);
         if(dot < max) { /// Don't bother if we're already over the max.
            if(quickTurn && dot < 0) {
               lv.subtract(V2.multiplyN(d, dot)); // Negate movement in the opposite direction.
            }
            lv.add(V2.multiplyN(d, inc)); /// New linear velocity.
            dot = d.dot(lv);
            if(dot > max) { /// Did we go over the maximum?
               lv.subtract(V2.multiplyN(d, dot - max)); /// compensate.
            }
            body.b2body.m_linearVelocity.v2 = lv;
         }
      }
Thanks about the edge chains, works well now. I have one other question if you guys don't mind. Is there a suggested technique for dealing with different gravities on different bodies? I'm trying to get just certain bodies to have zero gravity. In pre-2.1, I just modified a couple things in b2Island, but something tells me there is a better way to approaching this.
Thanks, works great:)

I ran into a problem with my character not moving left or right if I was standing still, but I somehow figured out to turn autoSleep to false and it fixed it haha. And I may be back with more questions 😳 so just a heads up.

Cheers.

Original thread: https://box2d.org/forum/viewtopic.php?t=4105