@defold-typescript/types 0.51.0 → 0.52.0
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/api-availability.json +4 -58
- package/api-signatures.json +878 -1356
- package/api-targets.json +15 -5
- package/examples/translations.json +4 -56
- package/generated/b2d_world.d.ts +10 -10
- package/generated/buffer.d.ts +9 -9
- package/generated/bullet3d_collision_object.d.ts +1 -1
- package/generated/bullet3d_constraint.d.ts +109 -7
- package/generated/bullet3d_shape.d.ts +2 -2
- package/generated/go.d.ts +114 -220
- package/generated/graphics.d.ts +1 -0
- package/generated/gui.d.ts +148 -371
- package/generated/http.d.ts +2 -2
- package/generated/image.d.ts +55 -3
- package/generated/kinds/gui-script.d.ts +2 -0
- package/generated/kinds/render-script.d.ts +14 -15
- package/generated/liveupdate.d.ts +5 -1
- package/generated/material.d.ts +3 -3
- package/generated/particlefx.d.ts +20 -1
- package/generated/physics.d.ts +45 -1
- package/generated/render-script-modules/b2d.d.ts +711 -0
- package/generated/render-script-modules/bullet3d.d.ts +73 -0
- package/generated/render-script-modules/collectionfactory.d.ts +25 -0
- package/generated/render-script-modules/collectionproxy.d.ts +39 -0
- package/generated/render-script-modules/factory.d.ts +25 -0
- package/generated/render-script-modules/go.d.ts +436 -0
- package/generated/render-script-modules/label.d.ts +105 -0
- package/generated/render-script-modules/model.d.ts +89 -0
- package/generated/render-script-modules/particlefx.d.ts +59 -0
- package/generated/render-script-modules/physics.d.ts +333 -0
- package/generated/render-script-modules/resource.d.ts +1233 -0
- package/generated/render-script-modules/sound.d.ts +227 -0
- package/generated/render-script-modules/sprite.d.ts +68 -0
- package/generated/render-script-modules/tilemap.d.ts +43 -0
- package/generated/render.d.ts +134 -8
- package/generated/resource.d.ts +31 -10
- package/generated/sprite.d.ts +49 -1
- package/generated/sys.d.ts +70 -6
- package/generated/versions/defold-1.12.4/buffer.d.ts +8 -8
- package/generated/versions/defold-1.12.4/go.d.ts +115 -343
- package/generated/versions/defold-1.12.4/graphics.d.ts +1 -0
- package/generated/versions/defold-1.12.4/gui.d.ts +151 -513
- package/generated/versions/defold-1.12.4/http.d.ts +2 -2
- package/generated/versions/defold-1.12.4/image.d.ts +82 -2
- package/generated/versions/defold-1.12.4/index.d.ts +1 -0
- package/generated/versions/defold-1.12.4/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.12.4/particlefx.d.ts +22 -1
- package/generated/versions/defold-1.12.4/physics.d.ts +45 -1
- package/generated/versions/defold-1.12.4/render.d.ts +78 -2
- package/generated/versions/defold-1.12.4/resource.d.ts +43 -10
- package/generated/versions/defold-1.12.4/sprite.d.ts +58 -1
- package/generated/versions/defold-1.12.4/sys.d.ts +101 -6
- package/generated/versions/defold-1.12.4/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.0/buffer.d.ts +8 -8
- package/generated/versions/defold-1.13.0/go.d.ts +115 -370
- package/generated/versions/defold-1.13.0/graphics.d.ts +1 -0
- package/generated/versions/defold-1.13.0/gui.d.ts +151 -513
- package/generated/versions/defold-1.13.0/http.d.ts +2 -2
- package/generated/versions/defold-1.13.0/image.d.ts +82 -2
- package/generated/versions/defold-1.13.0/index.d.ts +1 -0
- package/generated/versions/defold-1.13.0/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.13.0/material.d.ts +3 -1
- package/generated/versions/defold-1.13.0/particlefx.d.ts +22 -1
- package/generated/versions/defold-1.13.0/physics.d.ts +45 -1
- package/generated/versions/defold-1.13.0/render.d.ts +142 -4
- package/generated/versions/defold-1.13.0/resource.d.ts +43 -10
- package/generated/versions/defold-1.13.0/sprite.d.ts +58 -1
- package/generated/versions/defold-1.13.0/sys.d.ts +101 -6
- package/generated/versions/defold-1.13.0/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.1/buffer.d.ts +8 -8
- package/generated/versions/defold-1.13.1/go.d.ts +115 -370
- package/generated/versions/defold-1.13.1/graphics.d.ts +1 -0
- package/generated/versions/defold-1.13.1/gui.d.ts +151 -529
- package/generated/versions/defold-1.13.1/http.d.ts +2 -2
- package/generated/versions/defold-1.13.1/image.d.ts +82 -2
- package/generated/versions/defold-1.13.1/index.d.ts +2 -0
- package/generated/versions/defold-1.13.1/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.13.1/material.d.ts +3 -1
- package/generated/versions/defold-1.13.1/particlefx.d.ts +22 -1
- package/generated/versions/defold-1.13.1/physics.d.ts +45 -1
- package/generated/versions/defold-1.13.1/render.d.ts +142 -4
- package/generated/versions/defold-1.13.1/resource.d.ts +43 -10
- package/generated/versions/defold-1.13.1/sprite.d.ts +58 -1
- package/generated/versions/defold-1.13.1/sys.d.ts +101 -6
- package/generated/versions/defold-1.13.1/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.2/b2d_world.d.ts +10 -10
- package/generated/versions/defold-1.13.2/buffer.d.ts +9 -9
- package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +1 -1
- package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +109 -7
- package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +2 -2
- package/generated/versions/defold-1.13.2/go.d.ts +114 -220
- package/generated/versions/defold-1.13.2/graphics.d.ts +1 -0
- package/generated/versions/defold-1.13.2/gui.d.ts +148 -371
- package/generated/versions/defold-1.13.2/http.d.ts +2 -2
- package/generated/versions/defold-1.13.2/image.d.ts +55 -3
- package/generated/versions/defold-1.13.2/index.d.ts +2 -0
- package/generated/versions/defold-1.13.2/liveupdate.d.ts +5 -1
- package/generated/versions/defold-1.13.2/material.d.ts +3 -3
- package/generated/versions/defold-1.13.2/particlefx.d.ts +20 -1
- package/generated/versions/defold-1.13.2/physics.d.ts +45 -1
- package/generated/versions/defold-1.13.2/render.d.ts +123 -7
- package/generated/versions/defold-1.13.2/resource.d.ts +31 -10
- package/generated/versions/defold-1.13.2/sprite.d.ts +49 -1
- package/generated/versions/defold-1.13.2/sys.d.ts +70 -6
- package/generated/versions/defold-1.13.2/vmath.d.ts +0 -24
- package/generated/vmath.d.ts +0 -24
- package/identity-vocabulary.json +52 -7
- package/index.d.ts +2 -0
- package/package.json +2 -1
- package/scripts/generate-api-availability.ts +1 -21
- package/scripts/generate-api-signatures.ts +75 -14
- package/scripts/materialize-version.ts +48 -7
- package/scripts/regen.ts +214 -19
- package/scripts/signature-store-fs.ts +1 -0
- package/scripts/target-version.ts +26 -0
- package/src/api-doc.ts +26 -0
- package/src/component-properties.d.ts +89 -0
- package/src/core-types.ts +42 -15
- package/src/doc-corrections.ts +53 -5
- package/src/emit-dts.ts +758 -198
- package/src/engine-globals.d.ts +5 -1
- package/src/go-overloads.d.ts +68 -13
- package/src/gui-overloads.d.ts +489 -0
- package/src/gui-texture-removal.d.ts +41 -0
- package/src/index.ts +2 -0
- package/src/lifecycle.ts +30 -21
- package/src/msg-overloads.d.ts +25 -13
- package/src/signature-store.ts +50 -0
- package/src/timers.d.ts +2 -1
- package/src/vmath-overloads.d.ts +26 -0
package/generated/image.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ declare global {
|
|
|
54
54
|
/**
|
|
55
55
|
* Script buffer containing the decompressed image data.
|
|
56
56
|
*/
|
|
57
|
-
buffer: Opaque<"buffer"
|
|
57
|
+
buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> };
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
60
|
* Image loading options
|
|
@@ -141,7 +141,59 @@ declare global {
|
|
|
141
141
|
* });
|
|
142
142
|
* ```
|
|
143
143
|
*/
|
|
144
|
-
function load(buffer: string
|
|
144
|
+
function load(buffer: string): image.load_result | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Load image (PNG or JPEG) from buffer.
|
|
147
|
+
*
|
|
148
|
+
* @param buffer - image data buffer
|
|
149
|
+
* @param options - Optional loading parameters. A boolean is accepted for backwards compatibility and controls `premultiply_alpha`.
|
|
150
|
+
* @returns loaded image, or `nil` if loading fails
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* // How to load an image from an URL and create a GUI texture from it:
|
|
154
|
+
* const imgurl = "http://www.site.com/image.png";
|
|
155
|
+
* http.request(imgurl, "GET", (self, id, response) => {
|
|
156
|
+
* const img = response.response !== undefined ? image.load(response.response) : undefined;
|
|
157
|
+
* if (img !== undefined) {
|
|
158
|
+
* const tx = gui.new_texture("image_node", img.width, img.height, img.type, img.buffer);
|
|
159
|
+
* }
|
|
160
|
+
* });
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
function load(buffer: string, options: boolean | image.load_options): image.load_result | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Load image (PNG or JPEG) from a string buffer.
|
|
166
|
+
*
|
|
167
|
+
* @param buffer - image data buffer
|
|
168
|
+
* @param options - Optional loading parameters. A boolean is accepted for backwards compatibility and controls `premultiply_alpha`.
|
|
169
|
+
* @returns loaded image, or `nil` if loading fails
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* // Load an image from an URL as a buffer and create a texture resource from it:
|
|
173
|
+
* const imgurl = "http://www.site.com/image.png";
|
|
174
|
+
* http.request(imgurl, "GET", (self, id, response) => {
|
|
175
|
+
* const img =
|
|
176
|
+
* response.response !== undefined
|
|
177
|
+
* ? image.load_buffer(response.response, { flip_vertically: true })
|
|
178
|
+
* : undefined;
|
|
179
|
+
* // the engine registers a texture format only when the driver supports it
|
|
180
|
+
* const format = graphics.TEXTURE_FORMAT_RGBA;
|
|
181
|
+
* if (img !== undefined && format !== undefined) {
|
|
182
|
+
* const tparams = {
|
|
183
|
+
* width: img.width,
|
|
184
|
+
* height: img.height,
|
|
185
|
+
* type: graphics.TEXTURE_TYPE_2D,
|
|
186
|
+
* format,
|
|
187
|
+
* };
|
|
188
|
+
*
|
|
189
|
+
* const my_texture_id = resource.create_texture("/my_custom_texture.texturec", tparams, img.buffer);
|
|
190
|
+
* // Apply the texture to a model
|
|
191
|
+
* go.set("/go1#model", "texture0", my_texture_id);
|
|
192
|
+
* }
|
|
193
|
+
* });
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
function load_buffer(buffer: string): image.load_buffer_result | undefined;
|
|
145
197
|
/**
|
|
146
198
|
* Load image (PNG or JPEG) from a string buffer.
|
|
147
199
|
*
|
|
@@ -174,7 +226,7 @@ declare global {
|
|
|
174
226
|
* });
|
|
175
227
|
* ```
|
|
176
228
|
*/
|
|
177
|
-
function load_buffer(buffer: string, options
|
|
229
|
+
function load_buffer(buffer: string, options: boolean | image.load_options): image.load_buffer_result | undefined;
|
|
178
230
|
}
|
|
179
231
|
}
|
|
180
232
|
|
|
@@ -50,6 +50,8 @@ import "../../src/component-properties";
|
|
|
50
50
|
import "../../src/custom-messages";
|
|
51
51
|
import "../../src/engine-globals";
|
|
52
52
|
import "../../src/go-overloads";
|
|
53
|
+
import "../../src/gui-overloads";
|
|
54
|
+
import "../../src/gui-texture-removal";
|
|
53
55
|
import "../../src/message-guard";
|
|
54
56
|
import "../../src/msg-overloads";
|
|
55
57
|
import "../../src/physics-event-guard";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="lua-types/5.1" />
|
|
2
2
|
/// <reference types="lua-types/special/jit-only" />
|
|
3
|
-
import "../b2d";
|
|
3
|
+
import "../render-script-modules/b2d";
|
|
4
4
|
import "../b2d_body";
|
|
5
5
|
import "../b2d_chain";
|
|
6
6
|
import "../b2d_fixture";
|
|
@@ -8,39 +8,39 @@ import "../b2d_joint";
|
|
|
8
8
|
import "../b2d_shape";
|
|
9
9
|
import "../b2d_world";
|
|
10
10
|
import "../buffer";
|
|
11
|
-
import "../bullet3d";
|
|
11
|
+
import "../render-script-modules/bullet3d";
|
|
12
12
|
import "../bullet3d_collision_object";
|
|
13
13
|
import "../bullet3d_constraint";
|
|
14
14
|
import "../bullet3d_rigid_body";
|
|
15
15
|
import "../bullet3d_shape";
|
|
16
16
|
import "../bullet3d_world";
|
|
17
17
|
import "../camera";
|
|
18
|
-
import "../collectionfactory";
|
|
19
|
-
import "../collectionproxy";
|
|
18
|
+
import "../render-script-modules/collectionfactory";
|
|
19
|
+
import "../render-script-modules/collectionproxy";
|
|
20
20
|
import "../compute";
|
|
21
21
|
import "../crash";
|
|
22
|
-
import "../factory";
|
|
22
|
+
import "../render-script-modules/factory";
|
|
23
23
|
import "../font";
|
|
24
|
-
import "../go";
|
|
24
|
+
import "../render-script-modules/go";
|
|
25
25
|
import "../graphics";
|
|
26
26
|
import "../html5";
|
|
27
27
|
import "../http";
|
|
28
28
|
import "../image";
|
|
29
29
|
import "../json";
|
|
30
|
-
import "../label";
|
|
30
|
+
import "../render-script-modules/label";
|
|
31
31
|
import "../liveupdate";
|
|
32
32
|
import "../material";
|
|
33
|
-
import "../model";
|
|
33
|
+
import "../render-script-modules/model";
|
|
34
34
|
import "../msg";
|
|
35
|
-
import "../particlefx";
|
|
36
|
-
import "../physics";
|
|
35
|
+
import "../render-script-modules/particlefx";
|
|
36
|
+
import "../render-script-modules/physics";
|
|
37
37
|
import "../profiler";
|
|
38
|
-
import "../resource";
|
|
38
|
+
import "../render-script-modules/resource";
|
|
39
39
|
import "../socket";
|
|
40
|
-
import "../sound";
|
|
41
|
-
import "../sprite";
|
|
40
|
+
import "../render-script-modules/sound";
|
|
41
|
+
import "../render-script-modules/sprite";
|
|
42
42
|
import "../sys";
|
|
43
|
-
import "../tilemap";
|
|
43
|
+
import "../render-script-modules/tilemap";
|
|
44
44
|
import "../timer";
|
|
45
45
|
import "../types";
|
|
46
46
|
import "../vmath";
|
|
@@ -49,7 +49,6 @@ import "../zlib";
|
|
|
49
49
|
import "../../src/component-properties";
|
|
50
50
|
import "../../src/custom-messages";
|
|
51
51
|
import "../../src/engine-globals";
|
|
52
|
-
import "../../src/go-overloads";
|
|
53
52
|
import "../../src/message-guard";
|
|
54
53
|
import "../../src/msg-overloads";
|
|
55
54
|
import "../../src/physics-event-guard";
|
|
@@ -6,7 +6,7 @@ declare global {
|
|
|
6
6
|
* Functions and constants to access resources.
|
|
7
7
|
*/
|
|
8
8
|
namespace liveupdate {
|
|
9
|
-
type LIVEUPDATE = typeof liveupdate.LIVEUPDATE_BUNDLED_RESOURCE_MISMATCH | typeof liveupdate.LIVEUPDATE_ENGINE_VERSION_MISMATCH | typeof liveupdate.LIVEUPDATE_FORMAT_ERROR | typeof liveupdate.LIVEUPDATE_INVAL | typeof liveupdate.LIVEUPDATE_INVALID_HEADER | typeof liveupdate.LIVEUPDATE_INVALID_RESOURCE | typeof liveupdate.LIVEUPDATE_IO_ERROR | typeof liveupdate.LIVEUPDATE_MEM_ERROR | typeof liveupdate.LIVEUPDATE_OK | typeof liveupdate.LIVEUPDATE_SCHEME_MISMATCH | typeof liveupdate.LIVEUPDATE_SIGNATURE_MISMATCH | typeof liveupdate.LIVEUPDATE_UNKNOWN | typeof liveupdate.LIVEUPDATE_VERSION_MISMATCH;
|
|
9
|
+
type LIVEUPDATE = typeof liveupdate.LIVEUPDATE_BUNDLED_RESOURCE_MISMATCH | typeof liveupdate.LIVEUPDATE_ENGINE_VERSION_MISMATCH | typeof liveupdate.LIVEUPDATE_FORMAT_ERROR | typeof liveupdate.LIVEUPDATE_INVAL | typeof liveupdate.LIVEUPDATE_INVALID_HEADER | typeof liveupdate.LIVEUPDATE_INVALID_RESOURCE | typeof liveupdate.LIVEUPDATE_IO_ERROR | typeof liveupdate.LIVEUPDATE_MEM_ERROR | typeof liveupdate.LIVEUPDATE_OK | typeof liveupdate.LIVEUPDATE_SCHEME_MISMATCH | typeof liveupdate.LIVEUPDATE_SIGNATURE_MISMATCH | typeof liveupdate.LIVEUPDATE_UNKNOWN | typeof liveupdate.LIVEUPDATE_VERSION_MISMATCH | typeof liveupdate.LIVEUPDATE_NOT_INITIALIZED;
|
|
10
10
|
/**
|
|
11
11
|
* Mismatch between between expected bundled resources and actual bundled resources. The manifest expects a resource to be in the bundle, but it was not found in the bundle. This is typically the case when a non-excluded resource was modified between publishing the bundle and publishing the manifest.
|
|
12
12
|
*/
|
|
@@ -39,6 +39,10 @@ declare global {
|
|
|
39
39
|
* Memory wasn't allocated
|
|
40
40
|
*/
|
|
41
41
|
const LIVEUPDATE_MEM_ERROR: number & { readonly __brand: "liveupdate.LIVEUPDATE_MEM_ERROR" };
|
|
42
|
+
/**
|
|
43
|
+
* Live update is not initialized. `liveupdate.add_mount` and `liveupdate.remove_mount` return it while live update is disabled.
|
|
44
|
+
*/
|
|
45
|
+
const LIVEUPDATE_NOT_INITIALIZED: number & { readonly __brand: "liveupdate.LIVEUPDATE_NOT_INITIALIZED" };
|
|
42
46
|
/**
|
|
43
47
|
* Operation completed successfully.
|
|
44
48
|
*/
|
package/generated/material.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ declare global {
|
|
|
78
78
|
/**
|
|
79
79
|
* Sampler texture type.
|
|
80
80
|
*/
|
|
81
|
-
type: graphics.TEXTURE_TYPE;
|
|
81
|
+
type: graphics.TEXTURE_TYPE | 6 | 7 | 8 | 9 | 10;
|
|
82
82
|
/**
|
|
83
83
|
* Horizontal wrap mode.
|
|
84
84
|
*/
|
|
@@ -348,7 +348,7 @@ declare global {
|
|
|
348
348
|
* Returns a table of all the textures from the material.
|
|
349
349
|
*
|
|
350
350
|
* @param path - The path to the resource
|
|
351
|
-
* @returns material texture information
|
|
351
|
+
* @returns material texture information. Keyed by sampler slot from 1; a slot with no texture has no entry, so iterate with `for (const [slot, info] of textures)`.
|
|
352
352
|
* @example
|
|
353
353
|
* ```ts
|
|
354
354
|
* // Get the textures from a material specified as a resource property
|
|
@@ -363,7 +363,7 @@ declare global {
|
|
|
363
363
|
* });
|
|
364
364
|
* ```
|
|
365
365
|
*/
|
|
366
|
-
function get_textures(path: Hash | string): material.texture_info
|
|
366
|
+
function get_textures(path: Hash | string): LuaMap<number, material.texture_info>;
|
|
367
367
|
/**
|
|
368
368
|
* Returns a table of all the vertex attributes in the material. This function will return all the vertex attributes
|
|
369
369
|
* that are used in the vertex shader of the material.
|
|
@@ -128,7 +128,26 @@ declare global {
|
|
|
128
128
|
* });
|
|
129
129
|
* ```
|
|
130
130
|
*/
|
|
131
|
-
function stop(url: string | Hash | Url
|
|
131
|
+
function stop(url: string | Hash | Url): void;
|
|
132
|
+
/**
|
|
133
|
+
* Stops a particle FX component from playing.
|
|
134
|
+
* Stopping a particle FX does not remove already spawned particles.
|
|
135
|
+
* Which particle FX to stop is identified by the URL.
|
|
136
|
+
*
|
|
137
|
+
* @param url - the particle fx that should stop playing
|
|
138
|
+
* @param options - options used when stopping the particle fx
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* // How to stop a particle fx when a game object is deleted and immediately also
|
|
142
|
+
* // clear any spawned particles:
|
|
143
|
+
* export default defineScript({
|
|
144
|
+
* final(self) {
|
|
145
|
+
* particlefx.stop("#particlefx", { clear: true });
|
|
146
|
+
* },
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
function stop(url: string | Hash | Url, options: particlefx.stop_options): void;
|
|
132
151
|
interface properties {
|
|
133
152
|
/**
|
|
134
153
|
* The animation used during rendering by an emitter in a particle FX component.
|
package/generated/physics.d.ts
CHANGED
|
@@ -435,7 +435,51 @@ declare global {
|
|
|
435
435
|
* });
|
|
436
436
|
* ```
|
|
437
437
|
*/
|
|
438
|
-
function raycast_async(from: Vector3, to: Vector3, groups: Hash[]
|
|
438
|
+
function raycast_async(from: Vector3, to: Vector3, groups: Hash[]): void;
|
|
439
|
+
/**
|
|
440
|
+
* Ray casts are used to test for intersections against collision objects in the physics world.
|
|
441
|
+
* Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
|
|
442
|
+
* do not intersect with ray casts.
|
|
443
|
+
* Which collision objects to hit is filtered by their collision groups and can be configured
|
|
444
|
+
* through `groups`.
|
|
445
|
+
* The actual ray cast will be performed during the physics-update.
|
|
446
|
+
*
|
|
447
|
+
* - If an object is hit, the result will be reported via a ray_cast_response message.
|
|
448
|
+
* - If there is no object hit, the result will be reported via a ray_cast_missed message.
|
|
449
|
+
*
|
|
450
|
+
* NOTE: Ray casts will ignore collision objects that contain the starting point of the ray. This is a limitation in Box2D.
|
|
451
|
+
*
|
|
452
|
+
* @param from - the world position of the start of the ray
|
|
453
|
+
* @param to - the world position of the end of the ray
|
|
454
|
+
* @param groups - a lua table containing the hashed groups for which to test collisions against
|
|
455
|
+
* @param request_id - a number in range [0,255]. It will be sent back in the response for identification, 0 by default
|
|
456
|
+
* @example
|
|
457
|
+
* ```ts
|
|
458
|
+
* // How to perform a ray cast asynchronously:
|
|
459
|
+
* export default defineScript({
|
|
460
|
+
* init() {
|
|
461
|
+
* return { my_groups: [hash("my_group1"), hash("my_group2")] };
|
|
462
|
+
* },
|
|
463
|
+
*
|
|
464
|
+
* update(self, dt) {
|
|
465
|
+
* // request ray cast
|
|
466
|
+
* const my_start = go.get_world_position();
|
|
467
|
+
* const my_end = vmath.vector3(my_start.x, my_start.y - 100, my_start.z);
|
|
468
|
+
* physics.raycast_async(my_start, my_end, self.my_groups);
|
|
469
|
+
* },
|
|
470
|
+
*
|
|
471
|
+
* on_message(self, message_id, message, sender) {
|
|
472
|
+
* // check for the response
|
|
473
|
+
* if (message_id === hash("ray_cast_response")) {
|
|
474
|
+
* // act on the hit
|
|
475
|
+
* } else if (message_id === hash("ray_cast_missed")) {
|
|
476
|
+
* // act on the miss
|
|
477
|
+
* }
|
|
478
|
+
* },
|
|
479
|
+
* });
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
function raycast_async(from: Vector3, to: Vector3, groups: Hash[], request_id: number): void;
|
|
439
483
|
/**
|
|
440
484
|
* Only one physics world event listener can be set at a time.
|
|
441
485
|
*
|