revoluteJointDef.localAnchorA y 轴看起来不对
revoluteJointDef.localAnchorA y-axes looks wrong
从 this 开始,我希望下面的 RevoluteJoint bodyB 高于 y 轴上的蓝色框 - 设置
revoluteJointDef.localAnchorA
?
flame_forge2d: ^0.11.0
class Box extends BaseBox { // just a BodyComponent for same shape
BaseBox? boxB;
Box(position, paint, [this.boxB]) : super(position, paint);
@override
Body createBody() {
super.createBody();
if (this.boxB != null) {
paint.color = Colors.blue;
final revoluteJointDef = RevoluteJointDef();
revoluteJointDef.bodyA = body;
revoluteJointDef.bodyB = this.boxB!.body;
revoluteJointDef.localAnchorA.setFrom(Vector2(1, 1));
RevoluteJoint joint = RevoluteJoint(revoluteJointDef);
world.createJoint(joint);
}
return body;
}
}
我希望它是这样的:
在flame_forge2d 0.11.0
中坐标系在y-axis上翻转为与Flame相同的坐标系,因此较大的y-values会导致进一步向下,而不是像普通的 forge2d 那样更上一层楼。
只需取反锚点的 y-value 即可得到预期结果:
revoluteJointDef.localAnchorA.setFrom(Vector2(1, -1));
从 this 开始,我希望下面的 RevoluteJoint bodyB 高于 y 轴上的蓝色框 - 设置
revoluteJointDef.localAnchorA
?
flame_forge2d: ^0.11.0
class Box extends BaseBox { // just a BodyComponent for same shape
BaseBox? boxB;
Box(position, paint, [this.boxB]) : super(position, paint);
@override
Body createBody() {
super.createBody();
if (this.boxB != null) {
paint.color = Colors.blue;
final revoluteJointDef = RevoluteJointDef();
revoluteJointDef.bodyA = body;
revoluteJointDef.bodyB = this.boxB!.body;
revoluteJointDef.localAnchorA.setFrom(Vector2(1, 1));
RevoluteJoint joint = RevoluteJoint(revoluteJointDef);
world.createJoint(joint);
}
return body;
}
}
我希望它是这样的:
在flame_forge2d 0.11.0
中坐标系在y-axis上翻转为与Flame相同的坐标系,因此较大的y-values会导致进一步向下,而不是像普通的 forge2d 那样更上一层楼。
只需取反锚点的 y-value 即可得到预期结果:
revoluteJointDef.localAnchorA.setFrom(Vector2(1, -1));