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

Actually, possible bug regarding the RayCast function...

When raycasting, inside my callback function, if I try to access fixture.m_body.m_userdata.data, where fixture is the fixture passed as the first parameter to my callback, and data is a property of the userdata of the body (a property that I know to exist), the code crashes with this:

Code:
[Fault] exception, information=[object AlchemyExit]
Assertion failed: (0.0f <= lower && lower <= input.maxFraction), function RayCast, file ../Box2D/Collision/Shapes/b2PolygonShape.cpp, line 253.


The strange thing is, tracing 'fixture.m_body.m_userdata' is indicating that my userdata object is indeed there (and is an instance of the correct class, which should have the data property), but then just changing the code to trace 'fixture.m_body.m_userdata.data' with no other changes causes the crash. So, I'm not sure what's going on here.
Possible bug with SetActive();

If you call SetActive(true) it sets the body to false.
update:

Fixed bug where dead joints were staying in the AS3 joint list (thanks roman_m)
Fixed SetActive (thanks PaulGene)
Added the start of a test bed project (thanks roman_m)
Added the start of controllers and buoyancy (see the hello world project)
Fleshed out b2DebugDraw (thanks roman_m)

Note: I moved b2DebugDraw into it's own class, outside of world. The debug draw code was getting pretty hefty.

I also tweaked the test bed project to use the WCK Input and FPS classes (the ones provided had a copyright). Also made tests extend b2World so they can hook into the callback system.

shock-value: I'm not sure whats going on with your RayCast. Just like the C++ version you are supposed to return zero, one, or fraction (the last parameter passed in). What are you returning from your callback?
OK, my bad, I had marked the data parameter as protected rather than public so that's what was causing the error. Sorry about that!

(Side note: I'm still not exactly clear on what returning the fraction does however--anyone have any insight? I looked at the box2d docs but couldn't find anything, and can't come up with what other possibilities there would be besides continuing or not continuing the ray. In my project returning the fraction just seems to stop the ray.)

Also in line 56 of b2Body.as I believe you've got a duplicate definition--it's giving a compiler warning under Flex.
mayobutter: Nice to see you worked on TestBed. Now the code looks much better.

When trying to compile with flex sdk i've got warnings:
1. FPS.as line 67. I've added void as return type for function update().
2. b2Body.as line 56. I've commented out duplicate definition of variable je.
3. Lot's of warnings in Util.as. All about not specified types.

Also FlexSDK does not allow (or it's not easy) to setup classpaths so that one classpath is inside another. I just specified package Box2DAS.TestBed in all testbed files. Not sure that it will now compile with Flash (I just do not own one). If so, TestBed should be moved to separate directory.

In b2DebugDraw I've changed default scale to 1. And added options to draw axis for circle and to specify alpha.

Also I've removed file MyTest.as from TestBed. I do not think that it is interesting to anybody.
roman_m wrote:
Also FlexSDK does not allow (or it's not easy) to setup classpaths so that one classpath is inside another.

Code:
-allow-source-path-overlap=true
It seems that there is no collision between static and kinematic bodies, no response gets generated whatsoever, is this intended? I need to be able to know if there is a collision between those 2 types.
BorisTheBrave wrote:
Code:
-allow-source-path-overlap=true

Thanks. I removed classpaths from testbed.
Possible bug: velocityIterations and positionIterations parameters have no effect.
Edit: this bug was in testbed, not in box2d. Fixed.
any chance we can have QueryShape ❓

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