Rather than the RUBE demo's clacker with a limited range of motion, and realistic behaviour, mine is like a wind chime flapping around - and it even rotates in a full circle.
I have attempted to replace the
Code: Select all
rjd2.Initialize(bodyGround, bodyClacker, new b2Vec2(BODY_CLACKER_X / m_physScale, BODY_CLACKER_Y / m_physScale));
as advised with "set the bodies and local anchors for the joints directly instead of using the Initialize function"
but I'm having no luck when I try to do this.
With the clacker geometry, which I took from the demo:
Code: Select all
var clackerShapePolygons:Array =
[ -0.130863, -2.17848],
[0.288847, 0.0183992 ],
[ -0.223228, 0.288349],
[-0.288847, 0.0183992 ]
That initially sits upside down because of the Y increasing up in the demo, whereas Flash has Y increasing down.
So when I flip the sign of all the Y vertices in the data, the clacker fixture appears OK but for some reason there is no collision with the pins.
After all this is working, like in the RUBE demo, how would I go about spinning the wheel and getting it to land on a predetermined slot/angle?
With a basic non-box2d circle rotating there are a number of ways of doing this, such as with tweening to a certain angle etc but how to do it when physics are involved?
As no random numbers are involved, using the same starting parameters - wheel position, angular velocity given etc. - the wheel will always end at the same spot, but can certain positions be steered to somehow, rather than using trial and error?
Once again assistance is required.
I have attached the TestWheel.as file, which slots into the Box2DFlashAS3 project which is part of the Box2d download.