Commit 21489ab8 authored by Vũ Gia Vương's avatar Vũ Gia Vương

add dynamic rigibody

parent 6afb5718
......@@ -99,10 +99,10 @@
"_active": true,
"_components": [
{
"__id__": 154
"__id__": 176
},
{
"__id__": 155
"__id__": 177
}
],
"_prefab": null,
......@@ -5137,13 +5137,19 @@
"__id__": 115
},
{
"__id__": 151
"__id__": 167
},
{
"__id__": 169
},
{
"__id__": 172
}
],
"_active": true,
"_components": [
{
"__id__": 153
"__id__": 175
}
],
"_prefab": null,
......@@ -5332,8 +5338,8 @@
0,
0,
1,
1,
1,
2,
2,
1
]
},
......@@ -5394,13 +5400,13 @@
"__id__": 116
},
{
"__id__": 141
"__id__": 153
}
],
"_active": true,
"_components": [
{
"__id__": 150
"__id__": 166
}
],
"_prefab": null,
......@@ -5463,19 +5469,19 @@
"__id__": 117
},
{
"__id__": 121
"__id__": 123
},
{
"__id__": 125
"__id__": 129
},
{
"__id__": 129
"__id__": 135
},
{
"__id__": 133
"__id__": 141
},
{
"__id__": 137
"__id__": 147
}
],
"_active": true,
......@@ -5546,6 +5552,12 @@
},
{
"__id__": 120
},
{
"__id__": 121
},
{
"__id__": 122
}
],
"_prefab": null,
......@@ -5706,6 +5718,74 @@
],
"_id": "6f0VIVDhBLPqmSJl7BabDB"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 117
},
"_enabled": true,
"_type": 1,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "96E//LaSJPzq0bcVXbyPHa"
},
{
"__type__": "cc.PhysicsPolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 117
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"points": [
{
"__type__": "cc.Vec2",
"x": -50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": 50
},
{
"__type__": "cc.Vec2",
"x": -50,
"y": 50
}
],
"_id": "b36C/DBhlBQLDzkuU3At3u"
},
{
"__type__": "cc.Node",
"_name": "3",
......@@ -5717,13 +5797,19 @@
"_active": true,
"_components": [
{
"__id__": 122
"__id__": 124
},
{
"__id__": 123
"__id__": 125
},
{
"__id__": 124
"__id__": 126
},
{
"__id__": 127
},
{
"__id__": 128
}
],
"_prefab": null,
......@@ -5779,7 +5865,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 121
"__id__": 123
},
"_enabled": true,
"_materials": [
......@@ -5811,7 +5897,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 121
"__id__": 123
},
"_enabled": true,
"_id": "4f6Dt6/09FwL+yIiIkzOdP"
......@@ -5821,7 +5907,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 121
"__id__": 123
},
"_enabled": true,
"tag": 0,
......@@ -5914,6 +6000,74 @@
],
"_id": "48m94JTnZJF49No8VUxTS4"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 123
},
"_enabled": true,
"_type": 1,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "1cVmJ6N0hL5oSO/Xyubr+8"
},
{
"__type__": "cc.PhysicsPolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 123
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"points": [
{
"__type__": "cc.Vec2",
"x": -50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": 50
},
{
"__type__": "cc.Vec2",
"x": -50,
"y": 50
}
],
"_id": "08gVRCek9B8rCMCwhP1IMO"
},
{
"__type__": "cc.Node",
"_name": "2",
......@@ -5925,13 +6079,19 @@
"_active": true,
"_components": [
{
"__id__": 126
"__id__": 130
},
{
"__id__": 127
"__id__": 131
},
{
"__id__": 128
"__id__": 132
},
{
"__id__": 133
},
{
"__id__": 134
}
],
"_prefab": null,
......@@ -5987,7 +6147,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 125
"__id__": 129
},
"_enabled": true,
"_materials": [
......@@ -6019,7 +6179,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 125
"__id__": 129
},
"_enabled": true,
"_id": "63ZB/kFSVEKavLaqo0Hp3l"
......@@ -6029,7 +6189,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 125
"__id__": 129
},
"_enabled": true,
"tag": 0,
......@@ -6127,6 +6287,74 @@
],
"_id": "e7WUlmxT9KzJisRzEoQeZB"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 129
},
"_enabled": true,
"_type": 1,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "e7/g+MmHZGi6OdVGJ05XFO"
},
{
"__type__": "cc.PhysicsPolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 129
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"points": [
{
"__type__": "cc.Vec2",
"x": -50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": 50
},
{
"__type__": "cc.Vec2",
"x": -50,
"y": 50
}
],
"_id": "4fg7Y47ARP4oJ+dica//Aj"
},
{
"__type__": "cc.Node",
"_name": "4",
......@@ -6138,13 +6366,19 @@
"_active": true,
"_components": [
{
"__id__": 130
"__id__": 136
},
{
"__id__": 131
"__id__": 137
},
{
"__id__": 132
"__id__": 138
},
{
"__id__": 139
},
{
"__id__": 140
}
],
"_prefab": null,
......@@ -6200,7 +6434,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 129
"__id__": 135
},
"_enabled": true,
"_materials": [
......@@ -6232,7 +6466,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 129
"__id__": 135
},
"_enabled": true,
"_id": "21oKTWFXpPAbnbcJMb9BD0"
......@@ -6242,7 +6476,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 129
"__id__": 135
},
"_enabled": true,
"tag": 0,
......@@ -6360,6 +6594,74 @@
],
"_id": "38U9N/iIdDjZC1BSqUyuOR"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 135
},
"_enabled": true,
"_type": 1,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "9bjScVZJVKRr+2NYNxO7bS"
},
{
"__type__": "cc.PhysicsPolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 135
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"points": [
{
"__type__": "cc.Vec2",
"x": -50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": 50
},
{
"__type__": "cc.Vec2",
"x": -50,
"y": 50
}
],
"_id": "c42FEkaTFP+L34R+90vfQg"
},
{
"__type__": "cc.Node",
"_name": "1",
......@@ -6371,13 +6673,19 @@
"_active": true,
"_components": [
{
"__id__": 134
"__id__": 142
},
{
"__id__": 135
"__id__": 143
},
{
"__id__": 136
"__id__": 144
},
{
"__id__": 145
},
{
"__id__": 146
}
],
"_prefab": null,
......@@ -6433,7 +6741,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 133
"__id__": 141
},
"_enabled": true,
"_materials": [
......@@ -6465,7 +6773,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 133
"__id__": 141
},
"_enabled": true,
"tag": 0,
......@@ -6568,29 +6876,103 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 133
"__id__": 141
},
"_enabled": true,
"_id": "bcmluUpTRPK6hZlUXAbqw5"
},
{
"__type__": "cc.Node",
"_name": "5",
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"_parent": {
"__id__": 116
"node": {
"__id__": 141
},
"_children": [],
"_enabled": true,
"_type": 1,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "268Mde9LBJB6L90gfE520X"
},
{
"__type__": "cc.PhysicsPolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 141
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"points": [
{
"__type__": "cc.Vec2",
"x": -50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": 50
},
{
"__type__": "cc.Vec2",
"x": -50,
"y": 50
}
],
"_id": "598g5pOPpBDIZKalrZYocI"
},
{
"__type__": "cc.Node",
"_name": "5",
"_objFlags": 0,
"_parent": {
"__id__": 116
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 138
"__id__": 148
},
{
"__id__": 139
"__id__": 149
},
{
"__id__": 140
"__id__": 150
},
{
"__id__": 151
},
{
"__id__": 152
}
],
"_prefab": null,
......@@ -6646,7 +7028,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 137
"__id__": 147
},
"_enabled": true,
"_id": "68uH5Wy0NHeJJxTq87yA/F"
......@@ -6656,7 +7038,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 137
"__id__": 147
},
"_enabled": true,
"_materials": [
......@@ -6688,7 +7070,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 137
"__id__": 147
},
"_enabled": true,
"tag": 0,
......@@ -6791,6 +7173,74 @@
],
"_id": "57w0vFMsFD4J0JpX3pJOXf"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 147
},
"_enabled": true,
"_type": 1,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "f7ROoVqV9KlKaVlbxU9ZIC"
},
{
"__type__": "cc.PhysicsPolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 147
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"points": [
{
"__type__": "cc.Vec2",
"x": -50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": 50
},
{
"__type__": "cc.Vec2",
"x": -50,
"y": 50
}
],
"_id": "570aRhtbdMQJCjRfbfs9Y4"
},
{
"__type__": "cc.Node",
"_name": "Nap",
......@@ -6800,10 +7250,10 @@
},
"_children": [
{
"__id__": 142
"__id__": 154
},
{
"__id__": 146
"__id__": 160
}
],
"_active": true,
......@@ -6861,19 +7311,25 @@
"_name": "nap 2",
"_objFlags": 0,
"_parent": {
"__id__": 141
"__id__": 153
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 143
"__id__": 155
},
{
"__id__": 144
"__id__": 156
},
{
"__id__": 145
"__id__": 157
},
{
"__id__": 158
},
{
"__id__": 159
}
],
"_prefab": null,
......@@ -6929,7 +7385,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 142
"__id__": 154
},
"_enabled": true,
"_materials": [
......@@ -6961,7 +7417,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 142
"__id__": 154
},
"_enabled": true,
"tag": 0,
......@@ -7109,29 +7565,103 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 142
"__id__": 154
},
"_enabled": true,
"_id": "66j+VkXfpNoadfW56880/G"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 154
},
"_enabled": true,
"_type": 1,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "2a5ou60eFOHZzJUy0H2vzY"
},
{
"__type__": "cc.PhysicsPolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 154
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"points": [
{
"__type__": "cc.Vec2",
"x": -50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": 50
},
{
"__type__": "cc.Vec2",
"x": -50,
"y": 50
}
],
"_id": "2aeHK1109Lxp0IqDzRBAp5"
},
{
"__type__": "cc.Node",
"_name": "nap 1",
"_objFlags": 0,
"_parent": {
"__id__": 141
"__id__": 153
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 147
"__id__": 161
},
{
"__id__": 148
"__id__": 162
},
{
"__id__": 149
"__id__": 163
},
{
"__id__": 164
},
{
"__id__": 165
}
],
"_prefab": null,
......@@ -7187,7 +7717,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 146
"__id__": 160
},
"_enabled": true,
"_materials": [
......@@ -7219,7 +7749,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 146
"__id__": 160
},
"_enabled": true,
"_id": "24D4XJuZlE+q6fQu9Zy6vU"
......@@ -7229,7 +7759,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 146
"__id__": 160
},
"_enabled": true,
"tag": 0,
......@@ -7332,6 +7862,74 @@
],
"_id": "6dEWSFV2lAjZRMc+hEi4Uv"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 160
},
"_enabled": true,
"_type": 1,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "40GcwtmrhEuKRiuWWjVXMv"
},
{
"__type__": "cc.PhysicsPolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 160
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"points": [
{
"__type__": "cc.Vec2",
"x": -50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": -50
},
{
"__type__": "cc.Vec2",
"x": 50,
"y": 50
},
{
"__type__": "cc.Vec2",
"x": -50,
"y": 50
}
],
"_id": "b2Sk5SfGZJko4XQX7dgETM"
},
{
"__type__": "6fcd79x0JdPZKDzUr010UMy",
"_name": "",
......@@ -7353,7 +7951,7 @@
"_active": true,
"_components": [
{
"__id__": 152
"__id__": 168
}
],
"_prefab": null,
......@@ -7409,7 +8007,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 151
"__id__": 167
},
"_enabled": true,
"_materials": [
......@@ -7436,6 +8034,238 @@
"_atlas": null,
"_id": "4aeKl+F5NDy4t+ofdhiju2"
},
{
"__type__": "cc.Node",
"_name": "Ground",
"_objFlags": 0,
"_parent": {
"__id__": 110
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 170
},
{
"__id__": 171
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 2000,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-898.1,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "69sT2jMJ1Eo4eI0cKvUR7R"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 169
},
"_enabled": true,
"_type": 1,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "b9YodRnt9BtbHX8sfyUQpm"
},
{
"__type__": "cc.PhysicsBoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 169
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_size": {
"__type__": "cc.Size",
"width": 2000,
"height": 100
},
"_id": "b8Mk8Eu8dBG4ECrSWuKcF2"
},
{
"__type__": "cc.Node",
"_name": "default_sprite_splash",
"_objFlags": 0,
"_parent": {
"__id__": 110
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 173
},
{
"__id__": 174
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
3.01,
-526.727,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "a02Lxjqk9HJYVidyPlB44o"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 172
},
"_enabled": true,
"_type": 2,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "f1vILs+9dGzId9dSCs9quj"
},
{
"__type__": "cc.PhysicsBoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 172
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_size": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_id": "55p7kNBX9GUKwcKmGcqJ9A"
},
{
"__type__": "90267gmddZPkLBW/eIiYJR6",
"_name": "",
......@@ -7445,7 +8275,7 @@
},
"_enabled": true,
"spriteNode": {
"__id__": 151
"__id__": 167
},
"_id": "4eyUw4PwxKSq63DGUgJory"
},
......
......@@ -7,22 +7,40 @@ const { ccclass, property } = cc._decorator;
export default class FragmentController extends cc.Component {
private _collider: cc.PolygonCollider = null;
private _physicsCollider: cc.PhysicsPolygonCollider = null;
private _rg: cc.RigidBody = null;
onLoad() {
this._collider = this.node.getComponent(cc.PolygonCollider);
console.log('this._collider', this._collider.points.length)
this._physicsCollider = this.node.getComponent(cc.PhysicsPolygonCollider);
this._physicsCollider.points = this._collider.points;
this._physicsCollider.enabled = false;
this._rg = this.node.getComponent(cc.RigidBody);
eventTarget.on(CHECK_TOUCH, this.checkTouch, this);
}
private checkTouch(point: cc.Vec2) {
// console.log('point', point.toString(), this.node.position.toString());
const pos = point.clone().subtract(cc.v2(this.node.position.x, this.node.position.y));
let isInside = cc.Intersection.pointInPolygon(pos, this._collider.points);
// console.log('this._collider.points', this._collider.points.map(i => i.toString()));
if (isInside) {
console.log('isInside', isInside, pos.toString(), this.node.name)
this.dropFragment();
}
}
private dropFragment() {
const pos = this.node.position;
this.node.setSiblingIndex(-1);
cc.tween(this.node)
.to(0.2, { scale: 0.95 })
.to(0.2, { scale: 1.05, position: pos.clone().multiplyScalar(1.2) })
.call(() => {
this._physicsCollider.enabled = true;
this._rg.type = cc.RigidBodyType.Dynamic;
this._rg.gravityScale = 2;
})
.start();
}
}
......@@ -10,6 +10,8 @@ export default class BreakingBottleScreen extends cc.Component {
private spriteNode: cc.Node = null;
onLoad() {
cc.director.getPhysicsManager().enabled = true;
this.node.position = cc.v3(0, 0);
this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment