@safe-engine/cocos 2.4.0 → 2.4.2
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/dist/chipmunk/PhysicsComponent.d.ts +1 -1
- package/dist/chipmunk/PhysicsComponent.d.ts.map +1 -1
- package/dist/chipmunk/PhysicsSystem.d.ts.map +1 -1
- package/dist/chipmunk/PhysicsSystem.js +16 -10
- package/dist/chipmunk/index.d.ts +2 -2
- package/dist/chipmunk/index.d.ts.map +1 -1
- package/dist/chipmunk/index.js +3 -2
- package/dist/core/EnhancedComponent.d.ts.map +1 -1
- package/dist/core/EnhancedComponent.js +1 -1
- package/dist/core/Scene.d.ts.map +1 -1
- package/dist/core/Scene.js +5 -1
- package/dist/render/RenderSystem.d.ts +1 -2
- package/dist/render/RenderSystem.d.ts.map +1 -1
- package/dist/render/RenderSystem.js +0 -3
- package/package.json +2 -2
|
@@ -7,8 +7,8 @@ interface RigidBodyProps {
|
|
|
7
7
|
density?: Float;
|
|
8
8
|
restitution?: Float;
|
|
9
9
|
friction?: Float;
|
|
10
|
-
gravityScale?: Float;
|
|
11
10
|
isSensor?: boolean;
|
|
11
|
+
isLockRotate?: boolean;
|
|
12
12
|
tag?: number;
|
|
13
13
|
onBeginContact?: (other: RigidBody) => void;
|
|
14
14
|
onEndContact?: (other: RigidBody) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhysicsComponent.d.ts","sourceRoot":"","sources":["../../src/chipmunk/PhysicsComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,C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EAAE,EAAE,CAAC,KAAK;IAKjD,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK;IAKlD,iBAAiB,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK;IAkBtD,QAAQ;CAMT"}
|
|
@@ -30,7 +30,7 @@ export class PhysicsSystem {
|
|
|
30
30
|
rigidBody = instantiate(RigidBody);
|
|
31
31
|
entity.assign(rigidBody);
|
|
32
32
|
}
|
|
33
|
-
const { type =
|
|
33
|
+
const { type = DynamicBody, density = 1, friction = 0.5, restitution = 0.3, isSensor, isLockRotate, tag = 0 } = rigidBody.props;
|
|
34
34
|
const { width, height, offset = [] } = box.props;
|
|
35
35
|
const [x = 0, y = 0] = offset;
|
|
36
36
|
const node = entity.getComponent(NodeComp);
|
|
@@ -39,8 +39,9 @@ export class PhysicsSystem {
|
|
|
39
39
|
let shape;
|
|
40
40
|
let body;
|
|
41
41
|
if (type === DynamicBody) {
|
|
42
|
-
body = new cp.Body(density
|
|
42
|
+
body = new cp.Body(density, isLockRotate ? Infinity : cp.momentForBox(density, width, height));
|
|
43
43
|
shape = new cp.BoxShape2(body, new cp.BB(-hw + x, -hh + y, hw + x, hh + y));
|
|
44
|
+
body.setPos(node.position);
|
|
44
45
|
this.space.addShape(shape);
|
|
45
46
|
this.space.addBody(body);
|
|
46
47
|
}
|
|
@@ -49,6 +50,8 @@ export class PhysicsSystem {
|
|
|
49
50
|
body.nodeIdleTime = Infinity;
|
|
50
51
|
shape = new cp.BoxShape2(body, new cp.BB(-hw + x, -hh + y, hw + x, hh + y));
|
|
51
52
|
this.space.addStaticShape(shape);
|
|
53
|
+
body.setPos(node.position);
|
|
54
|
+
this.space.reindexStatic();
|
|
52
55
|
}
|
|
53
56
|
shape.setElasticity(restitution);
|
|
54
57
|
shape.setFriction(friction);
|
|
@@ -60,7 +63,6 @@ export class PhysicsSystem {
|
|
|
60
63
|
body.data = node;
|
|
61
64
|
shape.group = tag;
|
|
62
65
|
box.node = node;
|
|
63
|
-
body.setPos(node.position);
|
|
64
66
|
});
|
|
65
67
|
event_manager.subscribe(EventTypes.ComponentAdded, PhysicsCircleCollider, ({ entity, component }) => {
|
|
66
68
|
// console.log('ComponentAddedEvent PhysicsCircleCollider', component)
|
|
@@ -69,7 +71,7 @@ export class PhysicsSystem {
|
|
|
69
71
|
rigidBody = instantiate(RigidBody);
|
|
70
72
|
entity.assign(rigidBody);
|
|
71
73
|
}
|
|
72
|
-
const { type =
|
|
74
|
+
const { type = DynamicBody, isLockRotate, density = 1, friction = 0.5, restitution = 0.3, isSensor = false, tag = 0, } = rigidBody.props;
|
|
73
75
|
const node = entity.getComponent(NodeComp);
|
|
74
76
|
const { radius, offset = [] } = component.props;
|
|
75
77
|
const [x = 0, y = 0] = offset;
|
|
@@ -79,8 +81,9 @@ export class PhysicsSystem {
|
|
|
79
81
|
let shape;
|
|
80
82
|
let body;
|
|
81
83
|
if (type === DynamicBody) {
|
|
82
|
-
body = new cp.Body(density
|
|
84
|
+
body = new cp.Body(density, isLockRotate ? Infinity : cp.momentForCircle(density, radius, radius, offVect));
|
|
83
85
|
shape = new cp.CircleShape(body, radius, offVect);
|
|
86
|
+
body.setPos(node.position);
|
|
84
87
|
this.space.addShape(shape);
|
|
85
88
|
this.space.addBody(body);
|
|
86
89
|
}
|
|
@@ -89,6 +92,8 @@ export class PhysicsSystem {
|
|
|
89
92
|
body.nodeIdleTime = Infinity;
|
|
90
93
|
shape = new cp.CircleShape(body, radius, offVect);
|
|
91
94
|
this.space.addStaticShape(shape);
|
|
95
|
+
body.setPos(node.position);
|
|
96
|
+
this.space.reindexStatic();
|
|
92
97
|
}
|
|
93
98
|
shape.setElasticity(restitution);
|
|
94
99
|
shape.setFriction(friction);
|
|
@@ -101,7 +106,6 @@ export class PhysicsSystem {
|
|
|
101
106
|
body.data = node;
|
|
102
107
|
shape.group = tag;
|
|
103
108
|
component.node = node;
|
|
104
|
-
body.setPos(node.position);
|
|
105
109
|
});
|
|
106
110
|
event_manager.subscribe(EventTypes.ComponentAdded, PhysicsPolygonCollider, ({ entity, component }) => {
|
|
107
111
|
// console.log('ComponentAddedEvent PhysicsPolygonCollider', component)
|
|
@@ -110,7 +114,7 @@ export class PhysicsSystem {
|
|
|
110
114
|
rigidBody = instantiate(RigidBody);
|
|
111
115
|
entity.assign(rigidBody);
|
|
112
116
|
}
|
|
113
|
-
const { type =
|
|
117
|
+
const { type = DynamicBody, isLockRotate, density = 1, friction = 0.5, restitution = 0.3, isSensor, tag = 0 } = rigidBody.props;
|
|
114
118
|
const node = entity.getComponent(NodeComp);
|
|
115
119
|
const { points, offset = [] } = component.props;
|
|
116
120
|
const [x = 0, y = 0] = offset;
|
|
@@ -127,8 +131,9 @@ export class PhysicsSystem {
|
|
|
127
131
|
let shape;
|
|
128
132
|
let body;
|
|
129
133
|
if (type === DynamicBody) {
|
|
130
|
-
body = new cp.Body(density
|
|
134
|
+
body = new cp.Body(density, isLockRotate ? Infinity : cp.momentForPoly(density, fixedPoints, offVect));
|
|
131
135
|
shape = new cp.PolyShape(body, fixedPoints, offVect);
|
|
136
|
+
body.setPos(node.position);
|
|
132
137
|
this.space.addShape(shape);
|
|
133
138
|
this.space.addBody(body);
|
|
134
139
|
}
|
|
@@ -137,6 +142,8 @@ export class PhysicsSystem {
|
|
|
137
142
|
body.nodeIdleTime = Infinity;
|
|
138
143
|
shape = new cp.PolyShape(body, fixedPoints, offVect);
|
|
139
144
|
this.space.addStaticShape(shape);
|
|
145
|
+
body.setPos(node.position);
|
|
146
|
+
this.space.reindexStatic();
|
|
140
147
|
}
|
|
141
148
|
shape.setElasticity(restitution);
|
|
142
149
|
shape.setFriction(friction);
|
|
@@ -148,13 +155,12 @@ export class PhysicsSystem {
|
|
|
148
155
|
body.data = node;
|
|
149
156
|
shape.group = tag;
|
|
150
157
|
component.node = node;
|
|
151
|
-
body.setPos(node.position);
|
|
152
158
|
});
|
|
153
159
|
event_manager.subscribe(EventTypes.ComponentRemoved, RigidBody, ({ component }) => {
|
|
154
160
|
// console.log('ComponentRemovedEvent RigidBody', component)
|
|
155
161
|
if (component.enabled && component.physicSprite instanceof PhysicsSprite) {
|
|
156
162
|
const body = component.physicSprite.getBody();
|
|
157
|
-
if (body && this.space.containsBody(body)) {
|
|
163
|
+
if (body && (this.space.containsBody(body) || body.isStatic())) {
|
|
158
164
|
body.shapeList.forEach((shape) => {
|
|
159
165
|
if (shape && this.space.containsShape(shape)) {
|
|
160
166
|
if (!this.listRemoveShape.includes(shape)) {
|
package/dist/chipmunk/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Vec2 } from '..';
|
|
2
2
|
export * from './PhysicsComponent';
|
|
3
3
|
export * from './PhysicsSprite';
|
|
4
4
|
export * from './PhysicsSystem';
|
|
5
|
-
export declare function setupPhysics(
|
|
5
|
+
export declare function setupPhysics(colliderMatrix?: boolean[][], isDebugDraw?: boolean, gravity?: {
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
|
8
8
|
equals(other: /*elided*/ any): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chipmunk/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chipmunk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,IAAI,EAAE,MAAM,IAAI,CAAA;AAGpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAE/B,wBAAgB,YAAY,CAAC,cAAc,cAAW,EAAE,WAAW,UAAQ,EAAE,OAAO;;;;;;;;;;;;;;;;;;CAAe,QAOlG"}
|
package/dist/chipmunk/index.js
CHANGED
|
@@ -3,10 +3,11 @@ import { PhysicsSystem } from './PhysicsSystem';
|
|
|
3
3
|
export * from './PhysicsComponent';
|
|
4
4
|
export * from './PhysicsSprite';
|
|
5
5
|
export * from './PhysicsSystem';
|
|
6
|
-
export function setupPhysics(
|
|
7
|
-
const physicsSystem =
|
|
6
|
+
export function setupPhysics(colliderMatrix = [[true]], isDebugDraw = false, gravity = Vec2(0, -98)) {
|
|
7
|
+
const physicsSystem = GameWorld.Instance.addSystemAndUpdate(PhysicsSystem);
|
|
8
8
|
if (isDebugDraw) {
|
|
9
9
|
physicsSystem.addDebug();
|
|
10
10
|
}
|
|
11
|
+
physicsSystem.colliderMatrix = colliderMatrix;
|
|
11
12
|
physicsSystem.space.gravity = gravity;
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnhancedComponent.d.ts","sourceRoot":"","sources":["../../src/core/EnhancedComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,qBAAa,iBAAiB,CAAC,KAAK,GAAG,MAAM,EAAE,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC;IACpF,KAAK,EAAE,KAAK,CAAY;IACxB,IAAI,EAAE,CAAC,CAAA;IACP,OAAO,UAAO;gBACF,IAAI,CAAC,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,GAAG,KAAK;IAGhE,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK;IASjB,YAAY,CAAC,CAAC,SAAS,iBAAiB,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC;IAGzD,YAAY,CAAC,CAAC,SAAS,iBAAiB,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;IAGvE,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,QAA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Aa,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;IAG7E,OAAO,CAAC,KAAK,EAAE,iBAAiB;CAGjC;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,QAAQ,CAAA"}
|
|
@@ -19,7 +19,7 @@ export class EnhancedComponent {
|
|
|
19
19
|
getComponent(component) {
|
|
20
20
|
return this.node.getComponent(component);
|
|
21
21
|
}
|
|
22
|
-
schedule(callback, interval, repeat = cc.
|
|
22
|
+
schedule(callback, interval, repeat = cc.REPEAT_FOREVER, delay = 0) {
|
|
23
23
|
this.node.instance.schedule(callback.bind(this), interval, repeat, delay);
|
|
24
24
|
}
|
|
25
25
|
unschedule(callback) {
|
package/dist/core/Scene.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../src/core/Scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGvD,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,MAAM;
|
|
1
|
+
{"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../src/core/Scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGvD,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,MAAM;CAaP"}
|
package/dist/core/Scene.js
CHANGED
|
@@ -6,7 +6,11 @@ export class SceneComponent extends EnhancedComponent {
|
|
|
6
6
|
const world = GameWorld.Instance;
|
|
7
7
|
world.entities.reset();
|
|
8
8
|
const root = world.entities.create();
|
|
9
|
-
const
|
|
9
|
+
const scene = cc.director.getRunningScene();
|
|
10
|
+
scene.unscheduleAllCallbacks();
|
|
11
|
+
scene.stopAllActions();
|
|
12
|
+
scene.scheduleUpdate();
|
|
13
|
+
const node = root.assign(new NodeComp(scene, root));
|
|
10
14
|
const sceneComponent = root.assign(this);
|
|
11
15
|
sceneComponent.node = node;
|
|
12
16
|
return sceneComponent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EventManager, System } from 'entityx-ts';
|
|
2
2
|
export declare enum SpriteTypes {
|
|
3
3
|
SIMPLE = 0,
|
|
4
4
|
SLICED = 1,
|
|
@@ -17,6 +17,5 @@ export declare class RenderSystem implements System {
|
|
|
17
17
|
private onAddTiledMap;
|
|
18
18
|
private onAddMotionStreak;
|
|
19
19
|
private onRemovedNodeComp;
|
|
20
|
-
update(entities: EntityManager, events: EventManager, dt: number): any;
|
|
21
20
|
}
|
|
22
21
|
//# sourceMappingURL=RenderSystem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderSystem.d.ts","sourceRoot":"","sources":["../../src/render/RenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"RenderSystem.d.ts","sourceRoot":"","sources":["../../src/render/RenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoC,MAAM,EAAE,MAAM,YAAY,CAAA;AAKnF,oBAAY,WAAW;IACrB,MAAM,IAAA;IACN,MAAM,IAAA;IACN,KAAK,IAAA;IACL,MAAM,IAAA;IACN,IAAI,IAAA;IACJ,SAAS,IAAA;CACV;AA4CD,qBAAa,YAAa,YAAW,MAAM;IACzC,SAAS,CAAC,aAAa,EAAE,YAAY;IAWrC,OAAO,CAAC,eAAe,CAKtB;IAED,OAAO,CAAC,iBAAiB,CAgBxB;IAED,OAAO,CAAC,eAAe,CAatB;IAED,OAAO,CAAC,mBAAmB,CAQ1B;IAED,OAAO,CAAC,iBAAiB,CAKxB;IAED,OAAO,CAAC,aAAa,CAKpB;IAED,OAAO,CAAC,iBAAiB,CAUxB;IAED,OAAO,CAAC,iBAAiB,CAKxB;CAKF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@safe-engine/cocos",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "safe-engine with cocos renderer support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@cocos/dragonbones-js": "^1.0.2",
|
|
25
25
|
"@esotericsoftware/spine-core": "^4.2.93",
|
|
26
26
|
"box2d-wasm": "^7.0.0",
|
|
27
|
-
"cocos-html5-ts": "^2.1.
|
|
27
|
+
"cocos-html5-ts": "^2.1.2",
|
|
28
28
|
"entityx-ts": "^2.3.1"
|
|
29
29
|
},
|
|
30
30
|
"author": "",
|