我有一个动态的身体名称,并希望使其x位置跟随鼠标,这是可能的。
player = new Body(BodyType.DYNAMIC);
player.shapes.add(new Polygon(Polygon.rect(400, 350, 100, 150)));
player.shapes.add(new Polygon(Polygon.rect(435, 450, 20, 150)));
player.shapes.add(new Polygon(Polygon.rect(380, 600, 150, 20)));
player_mc = new MovieClip(Assets.tb.getTextures("player"));
player.userData.graphic = player_mc;
player.space = space;
addChild(player.userData.graphic);
答案 0 :(得分:3)
建议的方法是使用约束。
在FixedDragging示例中查看它是如何完成的:http://napephys.com/samples.html#swf-FixedDragging(在顶部查看带.as / .hx标签的源代码)