Quote:
i've managed to make a new world and adding new movieclips to it but every time i run it everything falls, the objects have all the physic properties but i can't figure out how to make the world to stay where i put it
You probably want to set the "isStatic" property to true for your objects that you want to stay put.
Quote:
, also can someone explain to me how to add functional joints?
Drag a symbol that extends "Joint" (like DemoJoint) onto the stage, and position it on top of whatever object you want to anchor to. The Joint class uses getObjectsUnderPoint to automatically anchor its self to a body. Then select the type of joint you'd like to make from the "type" drop down in the properties panel.
If you pick "RevolutePin", then your joint MC should be over one or more Shape / Body MCs. If it's over two, a revolute joint will be created between those bodies. If it's over one, that body will be connected to the world ground.
If you select "Prismatic", "Revolute", or "Distance", drag another Joint instance onto the stage on top of a different body. Like the first "Joint" instance, this will automatically anchor itself to whatever body it's on top of. DON'T select a "type" for this joint. Instead, give it a name ("instance name"), and then specify that name in the "target" property of the first Joint instance. The first Joint will look for the second one by it's name and connect them together.
If you select "Path"... forget about it. I've come up with another way to do this that's 10x easier.
Some times Joints can't find the body they're supposed to anchor to. If this is the case, you can explicitly set the body to anchor to via the "bodyName" property (this is the "instance name" of the body).
All of the other Joint properties translate pretty much directly to Box2d JointDef vars (enableMotor, enableLimit, etc.).
Quote:
If everything is defined in the authoring environment (properties panel?), how do you change things like the graivity vector (and radial on/off)
World instances have gravityX, gravityY, and gravityRadial properties.
Quote:
, as well as setting body.m_userData properties and static vs dynamic body creation?
The userdata is ALWAYS the movieclip that corresponds to the particular body / shape. The idea is that you extend "Shape" to create stuff with custom behaviors. You can always use the "as" operator to call your custom code. For example:
Code:
var mc = someB2Shape.m_userData as myCustomClassThatExtendsShape
if(mc) {
mc.myCustomAction();
}
if(mc) {
mc.myCustomAction();
}