mathHelper优化及注释。修复pointCircle错误实现

This commit is contained in:
yhh
2023-03-13 14:51:38 +08:00
parent 64bd6aa055
commit 72fdabd099
6 changed files with 1166 additions and 647 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@ module es {
// 为了处理偏移原点的旋转,我们只需要将圆心围绕(0,0)在一个圆上移动我们的偏移量就是0角
const offsetAngle = Math.atan2(collider.localOffset.y, collider.localOffset.x) * MathHelper.Rad2Deg;
const offsetLength = hasUnitScale ? collider._localOffsetLength : collider.localOffset.multiply(collider.entity.transform.scale).magnitude();
this.center = MathHelper.pointOnCirlce(Vector2.zero, offsetLength, collider.entity.transform.rotation + offsetAngle);
this.center = MathHelper.pointOnCircle(Vector2.zero, offsetLength, collider.entity.transform.rotation + offsetAngle);
}
}

View File

@@ -257,7 +257,7 @@ module es {
const offsetAngle = Math.atan2(collider.localOffset.y * collider.entity.transform.scale.y, collider.localOffset.x * collider.entity.transform.scale.x) * MathHelper.Rad2Deg;
const offsetLength = hasUnitScale ? collider._localOffsetLength :
collider.localOffset.multiply(collider.entity.transform.scale).magnitude();
this.center = MathHelper.pointOnCirlce(Vector2.zero, offsetLength,
this.center = MathHelper.pointOnCircle(Vector2.zero, offsetLength,
collider.entity.transform.rotationDegrees + offsetAngle);
}