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

okey, got that problem fixed also.
I'm wondering how can i refresh the world MC somehow, i want to make reset button for my levels so if you click the reset button it will put everything to its place and restores the removed objects.
thanks!
master wrote:
okey, got that problem fixed also.
I'm wondering how can i refresh the world MC somehow, i want to make reset button for my levels so if you click the reset button it will put everything to its place and restores the removed objects.
thanks!


Perhaps saving in an Array all object properties?
In wck the joint component properties are working for someone?

I put a revolute joint in a test and the two bodies conects and works ok, but if i enable the motor, appears to not work, enabling the limits the body appears to be fixed, enabling the spring do nothing. Changing the density of a body causes the flash CS5 to complain with errors and those errors keeps until the body is deleted from the stage. Changing the property restitution of any shape do not works for me, i must to assign the restitution in AS.

These are bugs in component properties, or i am dumb? 😀

And one more thing, i try to copy the properties of a box from the examples but the box from example appears to have less properties that the box i create, and i'm using the same classes definition for both my body and the body example.

What is wrong? The components or my brain?

Best regards.
update: The Alchemy Port is now up to date with r116 of Box2d, which includes the new b2EdgeShape and b2LoopShape! There may be bugs in this version, so proceed with caution. See the TestBed for example usage of edges + loops.
mayobutter wrote:
update: The Alchemy Port is now up to date with r116 of Box2d, which includes the new b2EdgeShape and b2LoopShape! There may be bugs in this version, so proceed with caution. See the TestBed for example usage of edges + loops.


thanks for the update: you asked for feedback and testing, here we go:

currently i had only the time to play around with the edge shapes. sometimes they work great, sometimes they crash. i build two small tests to show, the problems: http://www.swfcabin.com/open/1278655980

in both tests there are only two edge shapes, a poly (as box) and a circle. the upcoming coordinates are all divided by a scale value, but these numbers are much easier to handle:

the first test:
two edge chains, the left one flat, the right one slightly goes down. vertex 3 of the left shape ist vertex 2 of the right shape. vertex 0 of the right shape is vertex 1 of the left shape. the left one has no vertex 0, the right one no vertex 3. i think this should be the right usage of edge chains? seems to work really good, no crashed etc. the only strange thing is when you grab the circle or the box. try to push them trough the left edge. this will not work (as intended). but when you try to push the box through the right edge from the right side there is no collision. even after dragging it out and in again, the collision is gone. i think you have to drag the object out of the edge's bb the reactivate collisions.

the second test:
sam as test 1, but two modifications: first, the right edge not going down anymore. this is a scenaria which can happen in tiled levels. sliding across the edges works great here (box and poly!). the second change is that i added a vertex0 on the left shape. the circle has no problems at the edge, but the poly causes the alchemy part to crash (i think you mentioned this before?). i started altering the values. the crash will only occur if the y value of vertex 0 and vertex 1 are equal. if the y value of vertex 0 differs, it's working, but then sometimes there's no collision (like the right edge in ex. 1)

i hope this helps somehow. if you know what to do, you can build workarounds atm 😉

there are three minor issues in the current version:
in b2Fixture, line 262, the function m_proxyId has no return type
same in b2World, line 300 (function ClearForces)
finally, e_clearForces in b2World has no type declaration
Astrocreep: Can I get the source of your test beds? I'd like to play around with them. Fixed the type specification errors.
of course, but they are only simplified versions of the one you provided with wck.

edge1:
Code:
package {
   
   import Box2DAS.*;
   import Box2DAS.Collision.*;
   import Box2DAS.Collision.Shapes.*;
   import Box2DAS.Common.*;
   import Box2DAS.Dynamics.*;
   import Box2DAS.Dynamics.Contacts.*;
   import Box2DAS.Dynamics.Joints.*;
   import misc.*;
   import flash.events.*;
   import flash.utils.*;
   
   public class Edges1 extends Test {
      
      public function Edges1() {
         super();
         
         Main.txt.text = "Edges 1 (working)";
         
         b2Def.body.type = b2Body.b2_dynamicBody;
         b2Def.body.position.x = 100 / scale;
         b2Def.body.position.y = 100 / scale;
         b2Def.body.allowSleep = false;
         b2Def.circle.m_radius = 20 / scale;
         b2Def.polygon.SetAsBox(20 / scale, 20 / scale);
         //b2Def.fixture.shape = b2Def.polygon;
         b2Def.fixture.shape = b2Def.circle;
         b2Def.fixture.density = 1;
         var b:b2Body = b2Def.body.create(this);
         b2Def.fixture.create(b);
         
         b2Def.body.type = b2Body.b2_dynamicBody;
         b2Def.body.position.x = 250 / scale;
         b2Def.body.position.y = 100 / scale;
         b2Def.body.allowSleep = false;
         b2Def.polygon.SetAsBox(20 / scale, 20 / scale);
         b2Def.fixture.shape = b2Def.polygon;
         //b2Def.fixture.shape = b2Def.circle;
         b2Def.fixture.density = 1;
         b = b2Def.body.create(this);
         b2Def.fixture.create(b);
         
         b2Def.body.type = b2Body.b2_staticBody;
         b2Def.body.position.x = 300 / scale;
         b2Def.body.position.y = 400 / scale;
         b2Def.fixture.filter.groupIndex = -1;
         b2Def.fixture.shape = b2Def.edge;
         b2Def.edge.m_vertex0.v2 = new V2(00 / scale, 0 / scale);
         b2Def.edge.m_vertex1.v2 = new V2(-100 / scale, 0 / scale);
         b2Def.edge.m_vertex2.v2 = new V2(100 / scale, 0 / scale);
         b2Def.edge.m_vertex3.v2 = new V2(200 / scale, 50 / scale);
         //b2Def.edge.m_hasVertex0 = true;
         b2Def.edge.m_hasVertex3 = true;
         b = b2Def.body.create(this);
         b2Def.fixture.create(b);
         
         b2Def.body.type = b2Body.b2_staticBody;
         b2Def.body.position.x = 500 / scale;
         b2Def.body.position.y = 400 / scale;
         b2Def.fixture.filter.groupIndex = -1;
         b2Def.fixture.shape = b2Def.edge;
         b2Def.edge.m_vertex0.v2 = new V2(-200 / scale, 0 / scale);
         b2Def.edge.m_vertex1.v2 = new V2(-100 / scale, 0 / scale);
         b2Def.edge.m_vertex2.v2 = new V2(100 / scale, 50 / scale);
         b2Def.edge.m_vertex3.v2 = new V2(200 / scale, 100 / scale);
         b2Def.edge.m_hasVertex0 = true;
         //b2Def.edge.m_hasVertex3 = true;
         b = b2Def.body.create(this);
         b2Def.fixture.create(b);
         
         /*b2Def.fixture.shape = b2Def.loop;
         var s:Number =  100 / scale;
         var o:Number = 10 / scale;
         b2Def.loop.m_vertices = Vector.<V2>([
            new V2(-s, -s),
            new V2(-s, s),
            new V2(s + o, s + o),
            new V2(s, -s)
         ]);
         b2Def.body.position.x = 500 / scale;
         b2Def.body.position.y = 200 / scale;
         b = b2Def.body.create(this);
         b2Def.fixture.create(b);*/
      }      
   }
}


edge2 (same as 1, but only different edges):
Code:
...
         b2Def.body.type = b2Body.b2_staticBody;
         b2Def.body.position.x = 300 / scale;
         b2Def.body.position.y = 400 / scale;
         b2Def.fixture.filter.groupIndex = -1;
         b2Def.fixture.shape = b2Def.edge;
         b2Def.edge.m_vertex0.v2 = new V2(-200 / scale, 0 / scale);
         b2Def.edge.m_vertex1.v2 = new V2(-100 / scale, 0 / scale);
         b2Def.edge.m_vertex2.v2 = new V2(100 / scale, 0 / scale);
         b2Def.edge.m_vertex3.v2 = new V2(200 / scale, 0 / scale);
         b2Def.edge.m_hasVertex0 = true;
         b2Def.edge.m_hasVertex3 = true;
         b = b2Def.body.create(this);
         b2Def.fixture.create(b);
         
         b2Def.body.type = b2Body.b2_staticBody;
         b2Def.body.position.x = 500 / scale;
         b2Def.body.position.y = 400 / scale;
         b2Def.fixture.filter.groupIndex = -1;
         b2Def.fixture.shape = b2Def.edge;
         b2Def.edge.m_vertex0.v2 = new V2(-200 / scale, 0 / scale);
         b2Def.edge.m_vertex1.v2 = new V2(-100 / scale, 0 / scale);
         b2Def.edge.m_vertex2.v2 = new V2(100 / scale, 0 / scale);
         b2Def.edge.m_vertex3.v2 = new V2(200 / scale, 100 / scale);
         b2Def.edge.m_hasVertex0 = true;
         //b2Def.edge.m_hasVertex3 = true;
         b = b2Def.body.create(this);
         b2Def.fixture.create(b);
...
anitin wrote:
In wck the joint component properties are working for someone?

I put a revolute joint in a test and the two bodies conects and works ok, but if i enable the motor, appears to not work, enabling the limits the body appears to be fixed, enabling the spring do nothing. Changing the density of a body causes the flash CS5 to complain with errors and those errors keeps until the body is deleted from the stage. Changing the property restitution of any shape do not works for me, i must to assign the restitution in AS.

These are bugs in component properties, or i am dumb? 😀

And one more thing, i try to copy the properties of a box from the examples but the box from example appears to have less properties that the box i create, and i'm using the same classes definition for both my body and the body example.

What is wrong? The components or my brain?

Best regards.


Well i found the problem, i tested the wck in flash CS4 and the changes i made in the component inspector now works ok, this means that wck components do not work for me in CS5, but i have CS5 because CS4 do not works in Windows 7, someone knows how to solve this issue?

One more thing, in my tests in CS4 i can't drag the bodies in the screen, why?

thank you.
@anitin
i have flash cs3 and cs4 working in windows 7. cs3 gave me some issues with internet connection, there was a conflict with Bonjour which must have been installed with cs3 production premium.
flash cs4 has not conflicted with windows 7, although it was not a suite version like my cs3 was. (got tired of paying to upgrade programs i didn't need upgraded)

anyway, I'm sure mayobutter is interested in making sure it works with cs5, just letting you know my experience with windows7 and flash versions.
sketchbookgames wrote:
@anitin
i have flash cs3 and cs4 working in windows 7. cs3 gave me some issues with internet connection, there was a conflict with Bonjour which must have been installed with cs3 production premium.
flash cs4 has not conflicted with windows 7, although it was not a suite version like my cs3 was. (got tired of paying to upgrade programs i didn't need upgraded)

anyway, I'm sure mayobutter is interested in making sure it works with cs5, just letting you know my experience with windows7 and flash versions.


Ok, you are a lucky man, but in my laptop with Windows 7 Home Premium, Flash CS4 complains with an error and don't start, and i try all the solutions i read withouth any results.

😢

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