Game Development Reference
In-Depth Information
Now you can test the movie. Pick-and-drag each dynamic body, but the distance
between body origins won't change, thanks to distance joint.
While you can do a lot of stuff with mouse and distance joints, there is another joint
which is a life saver in game design: the revolute joint .
Making bodies rotate around a
point - revolute joints
Revolute joints force two bodies to be pinned in a common anchor point, leaving
only a single degree of freedom: the rotation around the anchor point. One of the
most common uses of revolute joints is the creation of wheels and cogs.
We will create wheels later when we build the siege machine. At the moment,
I just want to add another box to our script and pin it to the ground body to make
you see how to interact with revolute joints. We need to make only some changes
in the Main function:
public function Main() {
world=new b2World(new b2Vec2(0,9.81),true);
debugDraw();
var bodyDef:b2BodyDef=new b2BodyDef();
 
Search WWH ::




Custom Search