excalibur 0.26.0-alpha.367 → 0.26.0-alpha.368
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/build/dist/Collision/Colliders/CircleCollider.d.ts +7 -2
- package/build/dist/Collision/Colliders/CircleCollider.js +48 -10
- package/build/dist/Collision/Colliders/CircleCollider.js.map +1 -1
- package/build/dist/excalibur.js +50 -12
- package/build/dist/excalibur.js.map +1 -1
- package/build/dist/excalibur.min.js +1 -1
- package/build/dist/excalibur.min.js.LICENSE.txt +1 -1
- package/build/dist/excalibur.min.js.map +1 -1
- package/build/dist/index.js +2 -2
- package/build/esm/Collision/Colliders/CircleCollider.d.ts +7 -2
- package/build/esm/excalibur.js +50 -12
- package/build/esm/excalibur.js.map +1 -1
- package/build/esm/excalibur.min.js +1 -1
- package/build/esm/excalibur.min.js.LICENSE.txt +1 -1
- package/build/esm/excalibur.min.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -53,6 +53,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
53
53
|
|
|
54
54
|
### Fixed
|
|
55
55
|
|
|
56
|
+
- Fixed issue where `ex.CircleCollider`s did not respect rotation/scale when offset
|
|
56
57
|
- Fixed issue [#2157] when compiling in TS strict mode complaining about `ex.Poolable`
|
|
57
58
|
- Fixed issue where scaled graphics were not calculating the correct bounds
|
|
58
59
|
- Fixed unreleased issue where clock implementation was not updating frame id
|
|
@@ -27,10 +27,15 @@ export declare class CircleCollider extends Collider {
|
|
|
27
27
|
*/
|
|
28
28
|
offset: Vector;
|
|
29
29
|
get worldPos(): Vector;
|
|
30
|
+
private _naturalRadius;
|
|
30
31
|
/**
|
|
31
|
-
*
|
|
32
|
+
* Get the radius of the circle
|
|
32
33
|
*/
|
|
33
|
-
radius: number;
|
|
34
|
+
get radius(): number;
|
|
35
|
+
/**
|
|
36
|
+
* Set the radius of the circle
|
|
37
|
+
*/
|
|
38
|
+
set radius(val: number);
|
|
34
39
|
private _transform;
|
|
35
40
|
constructor(options: CircleColliderOptions);
|
|
36
41
|
/**
|
|
@@ -21,8 +21,32 @@ export class CircleCollider extends Collider {
|
|
|
21
21
|
this.radius = options.radius || 0;
|
|
22
22
|
}
|
|
23
23
|
get worldPos() {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
|
|
24
|
+
var _a, _b, _c, _d;
|
|
25
|
+
const tx = this._transform;
|
|
26
|
+
const scale = (_a = tx === null || tx === void 0 ? void 0 : tx.globalScale) !== null && _a !== void 0 ? _a : Vector.One;
|
|
27
|
+
const rotation = (_b = tx === null || tx === void 0 ? void 0 : tx.globalRotation) !== null && _b !== void 0 ? _b : 0;
|
|
28
|
+
const pos = ((_c = tx === null || tx === void 0 ? void 0 : tx.globalPos) !== null && _c !== void 0 ? _c : Vector.Zero);
|
|
29
|
+
return ((_d = this.offset) !== null && _d !== void 0 ? _d : Vector.Zero).scale(scale).rotate(rotation).add(pos);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the radius of the circle
|
|
33
|
+
*/
|
|
34
|
+
get radius() {
|
|
35
|
+
var _a;
|
|
36
|
+
const tx = this._transform;
|
|
37
|
+
const scale = (_a = tx === null || tx === void 0 ? void 0 : tx.globalScale) !== null && _a !== void 0 ? _a : Vector.One;
|
|
38
|
+
// This is a trade off, the alternative is retooling circles to support ellipse collisions
|
|
39
|
+
return this._naturalRadius * Math.min(scale.x, scale.y);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Set the radius of the circle
|
|
43
|
+
*/
|
|
44
|
+
set radius(val) {
|
|
45
|
+
var _a;
|
|
46
|
+
const tx = this._transform;
|
|
47
|
+
const scale = (_a = tx === null || tx === void 0 ? void 0 : tx.globalScale) !== null && _a !== void 0 ? _a : Vector.One;
|
|
48
|
+
// This is a trade off, the alternative is retooling circles to support ellipse collisions
|
|
49
|
+
this._naturalRadius = val / Math.min(scale.x, scale.y);
|
|
26
50
|
}
|
|
27
51
|
/**
|
|
28
52
|
* Returns a clone of this shape, not associated with any collider
|
|
@@ -37,8 +61,12 @@ export class CircleCollider extends Collider {
|
|
|
37
61
|
* Get the center of the collider in world coordinates
|
|
38
62
|
*/
|
|
39
63
|
get center() {
|
|
40
|
-
var _a, _b;
|
|
41
|
-
|
|
64
|
+
var _a, _b, _c, _d;
|
|
65
|
+
const tx = this._transform;
|
|
66
|
+
const scale = (_a = tx === null || tx === void 0 ? void 0 : tx.globalScale) !== null && _a !== void 0 ? _a : Vector.One;
|
|
67
|
+
const rotation = (_b = tx === null || tx === void 0 ? void 0 : tx.globalRotation) !== null && _b !== void 0 ? _b : 0;
|
|
68
|
+
const pos = ((_c = tx === null || tx === void 0 ? void 0 : tx.globalPos) !== null && _c !== void 0 ? _c : Vector.Zero);
|
|
69
|
+
return ((_d = this.offset) !== null && _d !== void 0 ? _d : Vector.Zero).scale(scale).rotate(rotation).add(pos);
|
|
42
70
|
}
|
|
43
71
|
/**
|
|
44
72
|
* Tests if a point is contained in this collider
|
|
@@ -142,16 +170,18 @@ export class CircleCollider extends Collider {
|
|
|
142
170
|
* Get the axis aligned bounding box for the circle collider in world coordinates
|
|
143
171
|
*/
|
|
144
172
|
get bounds() {
|
|
145
|
-
var _a;
|
|
173
|
+
var _a, _b, _c;
|
|
146
174
|
const tx = this._transform;
|
|
147
|
-
const
|
|
148
|
-
|
|
175
|
+
const scale = (_a = tx === null || tx === void 0 ? void 0 : tx.globalScale) !== null && _a !== void 0 ? _a : Vector.One;
|
|
176
|
+
const rotation = (_b = tx === null || tx === void 0 ? void 0 : tx.globalRotation) !== null && _b !== void 0 ? _b : 0;
|
|
177
|
+
const pos = ((_c = tx === null || tx === void 0 ? void 0 : tx.globalPos) !== null && _c !== void 0 ? _c : Vector.Zero);
|
|
178
|
+
return new BoundingBox(this.offset.x - this._naturalRadius, this.offset.y - this._naturalRadius, this.offset.x + this._naturalRadius, this.offset.y + this._naturalRadius).rotate(rotation).scale(scale).translate(pos);
|
|
149
179
|
}
|
|
150
180
|
/**
|
|
151
181
|
* Get the axis aligned bounding box for the circle collider in local coordinates
|
|
152
182
|
*/
|
|
153
183
|
get localBounds() {
|
|
154
|
-
return new BoundingBox(this.offset.x - this.
|
|
184
|
+
return new BoundingBox(this.offset.x - this._naturalRadius, this.offset.y - this._naturalRadius, this.offset.x + this._naturalRadius, this.offset.y + this._naturalRadius);
|
|
155
185
|
}
|
|
156
186
|
/**
|
|
157
187
|
* Get axis not implemented on circles, since there are infinite axis in a circle
|
|
@@ -197,9 +227,17 @@ export class CircleCollider extends Collider {
|
|
|
197
227
|
ctx.fill();
|
|
198
228
|
}
|
|
199
229
|
debug(ex, color) {
|
|
230
|
+
var _a, _b, _c, _d;
|
|
200
231
|
const tx = this._transform;
|
|
201
|
-
const
|
|
202
|
-
|
|
232
|
+
const scale = (_a = tx === null || tx === void 0 ? void 0 : tx.globalScale) !== null && _a !== void 0 ? _a : Vector.One;
|
|
233
|
+
const rotation = (_b = tx === null || tx === void 0 ? void 0 : tx.globalRotation) !== null && _b !== void 0 ? _b : 0;
|
|
234
|
+
const pos = ((_c = tx === null || tx === void 0 ? void 0 : tx.globalPos) !== null && _c !== void 0 ? _c : Vector.Zero);
|
|
235
|
+
ex.save();
|
|
236
|
+
ex.translate(pos.x, pos.y);
|
|
237
|
+
ex.rotate(rotation);
|
|
238
|
+
ex.scale(scale.x, scale.y);
|
|
239
|
+
ex.drawCircle(((_d = this.offset) !== null && _d !== void 0 ? _d : Vector.Zero), this._naturalRadius, Color.Transparent, color, 2);
|
|
240
|
+
ex.restore();
|
|
203
241
|
}
|
|
204
242
|
/**
|
|
205
243
|
* @deprecated signature will change in v0.26.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CircleCollider.js","sourceRoot":"","sources":["../../../../src/engine/Collision/Colliders/CircleCollider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC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MAAM,EAAE,CAAC;IACf,CAAC;CACF"}
|
package/build/dist/excalibur.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* excalibur - 0.26.0-alpha.
|
|
2
|
+
* excalibur - 0.26.0-alpha.368+6da310d - 2022-1-10
|
|
3
3
|
* https://github.com/excaliburjs/Excalibur
|
|
4
4
|
* Copyright (c) 2022 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
|
|
5
5
|
* Licensed BSD-2-Clause
|
|
@@ -14016,8 +14016,32 @@ class CircleCollider extends Collider {
|
|
|
14016
14016
|
this.radius = options.radius || 0;
|
|
14017
14017
|
}
|
|
14018
14018
|
get worldPos() {
|
|
14019
|
-
var _a, _b;
|
|
14020
|
-
|
|
14019
|
+
var _a, _b, _c, _d;
|
|
14020
|
+
const tx = this._transform;
|
|
14021
|
+
const scale = (_a = tx === null || tx === void 0 ? void 0 : tx.globalScale) !== null && _a !== void 0 ? _a : Vector.One;
|
|
14022
|
+
const rotation = (_b = tx === null || tx === void 0 ? void 0 : tx.globalRotation) !== null && _b !== void 0 ? _b : 0;
|
|
14023
|
+
const pos = ((_c = tx === null || tx === void 0 ? void 0 : tx.globalPos) !== null && _c !== void 0 ? _c : Vector.Zero);
|
|
14024
|
+
return ((_d = this.offset) !== null && _d !== void 0 ? _d : Vector.Zero).scale(scale).rotate(rotation).add(pos);
|
|
14025
|
+
}
|
|
14026
|
+
/**
|
|
14027
|
+
* Get the radius of the circle
|
|
14028
|
+
*/
|
|
14029
|
+
get radius() {
|
|
14030
|
+
var _a;
|
|
14031
|
+
const tx = this._transform;
|
|
14032
|
+
const scale = (_a = tx === null || tx === void 0 ? void 0 : tx.globalScale) !== null && _a !== void 0 ? _a : Vector.One;
|
|
14033
|
+
// This is a trade off, the alternative is retooling circles to support ellipse collisions
|
|
14034
|
+
return this._naturalRadius * Math.min(scale.x, scale.y);
|
|
14035
|
+
}
|
|
14036
|
+
/**
|
|
14037
|
+
* Set the radius of the circle
|
|
14038
|
+
*/
|
|
14039
|
+
set radius(val) {
|
|
14040
|
+
var _a;
|
|
14041
|
+
const tx = this._transform;
|
|
14042
|
+
const scale = (_a = tx === null || tx === void 0 ? void 0 : tx.globalScale) !== null && _a !== void 0 ? _a : Vector.One;
|
|
14043
|
+
// This is a trade off, the alternative is retooling circles to support ellipse collisions
|
|
14044
|
+
this._naturalRadius = val / Math.min(scale.x, scale.y);
|
|
14021
14045
|
}
|
|
14022
14046
|
/**
|
|
14023
14047
|
* Returns a clone of this shape, not associated with any collider
|
|
@@ -14032,8 +14056,12 @@ class CircleCollider extends Collider {
|
|
|
14032
14056
|
* Get the center of the collider in world coordinates
|
|
14033
14057
|
*/
|
|
14034
14058
|
get center() {
|
|
14035
|
-
var _a, _b;
|
|
14036
|
-
|
|
14059
|
+
var _a, _b, _c, _d;
|
|
14060
|
+
const tx = this._transform;
|
|
14061
|
+
const scale = (_a = tx === null || tx === void 0 ? void 0 : tx.globalScale) !== null && _a !== void 0 ? _a : Vector.One;
|
|
14062
|
+
const rotation = (_b = tx === null || tx === void 0 ? void 0 : tx.globalRotation) !== null && _b !== void 0 ? _b : 0;
|
|
14063
|
+
const pos = ((_c = tx === null || tx === void 0 ? void 0 : tx.globalPos) !== null && _c !== void 0 ? _c : Vector.Zero);
|
|
14064
|
+
return ((_d = this.offset) !== null && _d !== void 0 ? _d : Vector.Zero).scale(scale).rotate(rotation).add(pos);
|
|
14037
14065
|
}
|
|
14038
14066
|
/**
|
|
14039
14067
|
* Tests if a point is contained in this collider
|
|
@@ -14137,16 +14165,18 @@ class CircleCollider extends Collider {
|
|
|
14137
14165
|
* Get the axis aligned bounding box for the circle collider in world coordinates
|
|
14138
14166
|
*/
|
|
14139
14167
|
get bounds() {
|
|
14140
|
-
var _a;
|
|
14168
|
+
var _a, _b, _c;
|
|
14141
14169
|
const tx = this._transform;
|
|
14142
|
-
const
|
|
14143
|
-
|
|
14170
|
+
const scale = (_a = tx === null || tx === void 0 ? void 0 : tx.globalScale) !== null && _a !== void 0 ? _a : Vector.One;
|
|
14171
|
+
const rotation = (_b = tx === null || tx === void 0 ? void 0 : tx.globalRotation) !== null && _b !== void 0 ? _b : 0;
|
|
14172
|
+
const pos = ((_c = tx === null || tx === void 0 ? void 0 : tx.globalPos) !== null && _c !== void 0 ? _c : Vector.Zero);
|
|
14173
|
+
return new BoundingBox(this.offset.x - this._naturalRadius, this.offset.y - this._naturalRadius, this.offset.x + this._naturalRadius, this.offset.y + this._naturalRadius).rotate(rotation).scale(scale).translate(pos);
|
|
14144
14174
|
}
|
|
14145
14175
|
/**
|
|
14146
14176
|
* Get the axis aligned bounding box for the circle collider in local coordinates
|
|
14147
14177
|
*/
|
|
14148
14178
|
get localBounds() {
|
|
14149
|
-
return new BoundingBox(this.offset.x - this.
|
|
14179
|
+
return new BoundingBox(this.offset.x - this._naturalRadius, this.offset.y - this._naturalRadius, this.offset.x + this._naturalRadius, this.offset.y + this._naturalRadius);
|
|
14150
14180
|
}
|
|
14151
14181
|
/**
|
|
14152
14182
|
* Get axis not implemented on circles, since there are infinite axis in a circle
|
|
@@ -14192,9 +14222,17 @@ class CircleCollider extends Collider {
|
|
|
14192
14222
|
ctx.fill();
|
|
14193
14223
|
}
|
|
14194
14224
|
debug(ex, color) {
|
|
14225
|
+
var _a, _b, _c, _d;
|
|
14195
14226
|
const tx = this._transform;
|
|
14196
|
-
const
|
|
14197
|
-
|
|
14227
|
+
const scale = (_a = tx === null || tx === void 0 ? void 0 : tx.globalScale) !== null && _a !== void 0 ? _a : Vector.One;
|
|
14228
|
+
const rotation = (_b = tx === null || tx === void 0 ? void 0 : tx.globalRotation) !== null && _b !== void 0 ? _b : 0;
|
|
14229
|
+
const pos = ((_c = tx === null || tx === void 0 ? void 0 : tx.globalPos) !== null && _c !== void 0 ? _c : Vector.Zero);
|
|
14230
|
+
ex.save();
|
|
14231
|
+
ex.translate(pos.x, pos.y);
|
|
14232
|
+
ex.rotate(rotation);
|
|
14233
|
+
ex.scale(scale.x, scale.y);
|
|
14234
|
+
ex.drawCircle(((_d = this.offset) !== null && _d !== void 0 ? _d : Vector.Zero), this._naturalRadius, Color.Transparent, color, 2);
|
|
14235
|
+
ex.restore();
|
|
14198
14236
|
}
|
|
14199
14237
|
/**
|
|
14200
14238
|
* @deprecated signature will change in v0.26.0
|
|
@@ -29987,7 +30025,7 @@ Promises_Promise = Promise_1 = Promises_decorate([
|
|
|
29987
30025
|
* The current Excalibur version string
|
|
29988
30026
|
* @description `process.env.__EX_VERSION` gets replaced by Webpack on build
|
|
29989
30027
|
*/
|
|
29990
|
-
const EX_VERSION = "0.26.0-alpha.
|
|
30028
|
+
const EX_VERSION = "0.26.0-alpha.368+6da310d";
|
|
29991
30029
|
|
|
29992
30030
|
polyfill();
|
|
29993
30031
|
// This file is used as the bundle entry point and exports everything
|