You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: en/editor/project/index.md
+4-1
Original file line number
Diff line number
Diff line change
@@ -86,11 +86,14 @@ Used to configure various parameters of physics, please refer to the [Physics Co
86
86
87
87
-**MAX_LABEL_CANVAS_POOL_SIZE**: set the maximum number of Canvas object pools used by the Label, and adjust it according to the number of Labels in the same scene of the project.
88
88
89
-
-**ENABLE_WEBGL_HIGHP_STRUCT_VALUES**: on the Android platform with WebGL backend, the internal variables of the structures defined in the fragment shader use **mediump** precision, which may lead to incorrect results for some data that requires high precision (such as position information). To avoid this problem, check this option (new in v3.4.1) and enable WebGL to calculate variables with **highp** precision.
89
+
-**ENABLE_WEBGL_HIGHP_STRUCT_VALUES** (new in v3.4.1): on the Android platform with WebGL backend, the internal variables of the structures defined in the fragment shader use **mediump** precision, which may lead to incorrect results for some data that requires high precision (such as position information). To avoid this problem, check this option and enable WebGL to calculate variables with **highp** precision.
90
90
91
91
- If this option is enabled, use the `HIGHP_VALUE_STRUCT_DEFINE` macro in the fragment shader code to define structural variables, and use `HIGHP_VALUE_TO_STRUCT_DEFINED` and `HIGHP_VALUE_FROM_STRUCT_DEFINED` to assign values between structural and non-structural variables.
92
+
92
93
- For specific information and code on the above macro calls, please refer to [packing.chunk](https://github.com/cocos-creator/engine/blob/v3.4.1/editor/assets/chunks/packing.chunk#L40) for details.
93
94
95
+
-**BATCHER2D_MEM_INCREMENT** (new in v3.4.1): this option affects the maximum number of vertices in each MeshBuffer, the default value is 144KB, please refer to the [MeshBuffer Batch Description](../../ui-system/components/engine/ui-batch.md) documentation for the conversion relationship between the number and the value.
96
+
94
97
-**Custom Macro**: used to customize macro configurations, providing a macro tagging feature for current project scripts for easy visual configuration. Click the **+** button below to add a new macro configuration, hover over the added macro configuration and the **Delete** and **Modify** buttons will be displayed on the left side for deleting/renaming the current macro configuration respectively.
Copy file name to clipboardexpand all lines: en/editor/publish/publish-wechatgame.md
+3
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,8 @@ In addition, the game submission, review and release process of the **WeChat Min
42
42
43
43
### Build Options
44
44
45
+

46
+
45
47
| Options | Optional or not | Default | Explanation |
46
48
| :-- | :-- | :-- | :-- |
47
49
|**appid**| Required |`wx6ac3f5090a6b99c5`| The appid of the WeChat Mini Games, it will be written to `project.config.json` file.|
@@ -51,6 +53,7 @@ In addition, the game submission, review and release process of the **WeChat Min
51
53
|**Orientation**| Required |`landscape`| Device orientation, it will be written to `game.json` file.|
52
54
|**Separate Engine**| Optional | Empty | Whether to use WeChat Mini Games engine plugin, please refer to [WeChat Mini Games Engine Plugin Instructions](./wechatgame-plugin.md) for details. |
53
55
|**Wasm 3D physics system (based on `ammo.js`)**| Optional | Enabled | This option is used to select whether to enable **Wasm**, which takes effect when using **bullet(ammo.js)** physics. Please refer to the **WebAssembly Support** section below for more details. |
56
+
|**Whether to enabled WebGL2** (Experimental feature) | - | Forced Off | In order to allow WebGL 2.0 to be enabled on WeChat Mini Games in the future, we have added this option in **v3.4.1** to support to enable WebGL 2.0 following the configuration in the **Project Settings** panel, and to turn off to reduce the package by default.<br>If this option is set to **Consistent with project settings** and **WebGL 2.0** is checked in **Project Settings -> Feature Cropping**, it will be successfully enabled in the future if the WeChat environment supports WebGL 2.0. |
54
57
55
58
## Asset Management for WeChat Mini Game Environment
As mentioned in the previous document, `EventTarget` supports a complete set of event listening and emitting mechanisms. In Cocos Creator v3.4.0, `input` object is supported, which implements the event registering interface of `EventTarget`, and can register global system input events through this object. The original `systemEvent` object has been deprecated since v3.4.0, and the differences between `systemEvent` and `input`are as follows:
3
+
As mentioned in the previous document, `EventTarget` supports a complete set of event listening and emitting mechanisms. In Cocos Creator v3.4.0, `input` object is supported, which implements the event registering interface of `EventTarget`, and can register global system input events through this object. The original `systemEvent` object has been deprecated since v3.4.0 and will be gradually removed in the future, we recommend using the `input`object as a replacement.
4
4
5
-
- The declaration of touch event callback in `systemEvent` is `(touch: Touch, event: EventTouch) => void`
6
-
- The declaration of touch event callback in `input` is `(event: EventTouch) => void`
5
+
The differences between `systemEvent` and `input` are as follows:
7
6
8
-
__Note__: in v3 4.0 there are also the following differences between the two objects:
9
-
- The event listener of `systemEvent` will be intercepted by the event listener of the node.
10
-
-`input` objects have higher priority than nodes and will not be intercepted.
11
-
We have lowered the priority of 'input' in v3.4.1. Currently, there is no difference in priority between the two objects.
7
+
-**Differences in type definitions**
12
8
13
-
> __Note__: the `systemEvent` object is no longer recommended and will be phased out in the future, we recommend using the `input` object as a replacement.
9
+
- The declaration of touch event callback in `systemEvent` is `(touch: Touch, event: EventTouch) => void`
14
10
15
-
In this section, the `global input events` of __Cocos Creator__ will be introduced.
11
+
- The declaration of touch event callback in `input` is `(event: EventTouch) => void`
16
12
17
-
`Global input events` are irrelevant with the node hierarchy, so they are dispatched globally by `input`, currently supported:
13
+
-**Differences in priority**
14
+
15
+
- The event listener of `systemEvent` will be intercepted by the event listener of the node.
16
+
17
+
-`input` objects have higher priority than nodes and will not be intercepted.
18
+
19
+
> __Note__: we lowered the priority of `input` in **v3.4.1**, so there is no difference in priority between the two objects since v3.4.1.
20
+
21
+
---
22
+
23
+
In this section, the handling of global input events in Cocos Creator will be introduced.
24
+
25
+
**Global input events** are irrelevant with the node hierarchy, so they are dispatched globally by `input`, currently supported:
18
26
19
27
- Mouse
20
28
- Touch
21
-
- Keyboard
29
+
- Keyboard
22
30
- DeviceMotion
23
31
24
32
## How to define the input events
25
33
26
-
Use `input.on(type, callback, target)` to register global input event listeners.
34
+
Use `input.on(type, callback, target)` to register global input event listeners. Event types included:
-[EventMouse](__APIDOC__/en/#/docs/3.4/en/cocos-input-types-event/Class/EventMouse) or [EventTouch](__APIDOC__/en/#/docs/3.4/en/cocos-input-types-event/Class/EventTouch)
46
76
47
77
Examples of the use of pointer events are as follows:
@@ -69,12 +99,24 @@ export class Example extends Component {
69
99
70
100
### Keyboard events
71
101
72
-
- Event Listener Types: `Input.EventType.KEY_DOWN`,`Input.EventType.KEY_PRESSING` and `Input.EventType.KEY_UP`
@@ -138,54 +188,55 @@ export class Example extends Component {
138
188
}
139
189
```
140
190
141
-
Please review the [test-cases-3d](https://github.com/cocos-creator/test-cases-3d/tree/v3.4/assets/cases/event) (This includes the keyboard, accelerometer, singletouch, multi-touch examples).
191
+
The specific usage can be found in the example [event](https://github.com/cocos-creator/test-cases-3d/tree/v3.4/assets/cases/event), which contains the implementation of keyboard, accelerometer, single-touch, multi-touch and other functions.
142
192
143
193
## Touch detection for 3D objects
144
194
145
195
The touch detection for 3D objects and 2D UI nodes is different:
146
196
147
-
- 2D UI nodes only need the size information provided by the `UITransform` component and the position information of the node to do the touch detection. For details, please refer to [Node Event System](event-node.ts).
197
+
- 2D UI nodes only need the size information provided by the `UITransform` component and the position information of the node to do the touch detection. For details, please refer to [Node Event System](event-node.md).
198
+
148
199
- The touch detection for 3D objects needs to be implemented by ray cast. The specific method is to generate a ray from the rendering camera of the 3D object to the screen coordinates of the touch point to determine whether the ray hits the object that was detected. The specific code implementation is as follows:
Copy file name to clipboardexpand all lines: en/engine/event/event-node.md
+4-16
Original file line number
Diff line number
Diff line change
@@ -120,7 +120,7 @@ Touch events support the event bubbling on the node tree, take the pictures belo
120
120
121
121
In the scene shown in the picture, suppose node A has a child node B which has a child node C. The developer sets the touch event listeners for all these three nodes (each node has a touch event listener in examples below by default).
122
122
123
-
When the mouse or finger was applied in the node C region, the event will be triggered at node C first and the node C listener will receive the event (this is the target phase). Then the node C will pass this event to its parent node, so the node B listener will receive this event. Similarly the node B will also pass the event to its parent node A. This is a basic event bubbling phase.
123
+
When the mouse or finger was applied in the node C region, the event will be triggered at node C first and the node C listener will receive the event (this is the target phase). Then the node C will pass this event to its parent node, so the node B listener will receive this event. Similarly the node B will also pass the event to its parent node A. This is a basic event bubbling phase.
124
124
125
125
> __Note__: it needs to be emphasized that there is no hit test in parent nodes in the bubbling phase, which means that nodes A and B can receive touch events even though the touch location is out of their node area.
126
126
@@ -132,9 +132,9 @@ Suppose the node B and C in the picture above are brother nodes, while C partly
132
132
133
133
At the same time, if C has a parent node, it will also pass the touch event to its parent node through the event bubble mechanism.
134
134
135
-
In v3.4.0, the ability of event penetrating dispatch is supported. In this example, if the event needs to be dispatched to node B, the event can be prevented from being swallowed by node C by calling `event.preventSwallow = true`.
135
+
In v3.4.0, the ability of event penetrating dispatch is supported. In this example, if the event needs to be dispatched to node B, the event can be prevented from being swallowed by node C by calling `event.preventSwallow = true`.
136
136
137
-
> __Note__: the event penetrating dispatch reduces the efficiency of event dispatch, please use it with caution.
137
+
> __Note__: the event penetrating dispatch reduces the efficiency of event dispatch, please use it with caution.
138
138
139
139
### Point of Contact Attribution for Different Canvas
140
140
@@ -158,7 +158,7 @@ Only touch or mouse events can be registered in the capturing phase, while the o
158
158
159
159
### Event Interception
160
160
161
-
Normal events are dispensed as described above. However, if the node has components such as `Button`, `Toggle` or `BlockInputEvents` on it, it will stop event bubbling.
161
+
Normal events are dispensed as described above. However, if the node has components such as `Button`, `Toggle` or `BlockInputEvents` on it, it will stop event bubbling.
162
162
163
163
Look at the picture below. There are two buttons, priority 1 for Canvas0 and priority 2 for Canvas1. Click on the intersection of the two buttons, which is the blue area in the picture, it appears that button priority 2 received the contact event successfully, while button priority 1 did not. <br>That's because according to the event reception rules above, button priority 2 receives contact events first and intercepts them (`event.propagationStopped = true`) to prevent event penetration. If the node is a non-button node, events can also be intercepted by adding the `BlockInputEvents` component to prevent penetration.
0 commit comments