@dcl/protocol 1.0.0-4468031496.commit-eace17b → 1.0.0-4493564897.commit-c858f8a
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/out-js/decentraland/sdk/components/common/camera_type.gen.d.ts +2 -0
- package/out-js/decentraland/sdk/components/common/camera_type.gen.js +7 -0
- package/out-js/decentraland/sdk/components/common/camera_type.gen.js.map +1 -1
- package/out-js/decentraland/sdk/components/common/input_action.gen.d.ts +10 -0
- package/out-js/decentraland/sdk/components/common/input_action.gen.js +47 -1
- package/out-js/decentraland/sdk/components/common/input_action.gen.js.map +1 -1
- package/out-js/decentraland/sdk/components/common/raycast_hit.gen.d.ts +173 -0
- package/out-js/decentraland/sdk/components/common/raycast_hit.gen.js +156 -0
- package/out-js/decentraland/sdk/components/common/raycast_hit.gen.js.map +1 -0
- package/out-js/decentraland/sdk/components/mesh_collider.gen.d.ts +16 -1
- package/out-js/decentraland/sdk/components/mesh_collider.gen.js +86 -1
- package/out-js/decentraland/sdk/components/mesh_collider.gen.js.map +1 -1
- package/out-js/decentraland/sdk/components/pointer_events.gen.d.ts +1 -11
- package/out-js/decentraland/sdk/components/pointer_events.gen.js +3 -49
- package/out-js/decentraland/sdk/components/pointer_events.gen.js.map +1 -1
- package/out-js/decentraland/sdk/components/pointer_events_result.gen.d.ts +10 -11
- package/out-js/decentraland/sdk/components/pointer_events_result.gen.js +10 -11
- package/out-js/decentraland/sdk/components/pointer_events_result.gen.js.map +1 -1
- package/out-js/decentraland/sdk/components/raycast.gen.d.ts +239 -38
- package/out-js/decentraland/sdk/components/raycast.gen.js +145 -20
- package/out-js/decentraland/sdk/components/raycast.gen.js.map +1 -1
- package/out-js/decentraland/sdk/components/raycast_result.gen.d.ts +26 -176
- package/out-js/decentraland/sdk/components/raycast_result.gen.js +21 -186
- package/out-js/decentraland/sdk/components/raycast_result.gen.js.map +1 -1
- package/out-ts/decentraland/sdk/components/common/camera_type.gen.ts +7 -0
- package/out-ts/decentraland/sdk/components/common/input_action.gen.ts +46 -0
- package/out-ts/decentraland/sdk/components/common/raycast_hit.gen.ts +204 -0
- package/out-ts/decentraland/sdk/components/mesh_collider.gen.ts +86 -1
- package/out-ts/decentraland/sdk/components/pointer_events.gen.ts +8 -47
- package/out-ts/decentraland/sdk/components/pointer_events_result.gen.ts +11 -5
- package/out-ts/decentraland/sdk/components/raycast.gen.ts +180 -26
- package/out-ts/decentraland/sdk/components/raycast_result.gen.ts +24 -232
- package/package.json +2 -2
- package/proto/decentraland/sdk/components/common/camera_type.proto +1 -0
- package/proto/decentraland/sdk/components/common/input_action.proto +8 -0
- package/proto/decentraland/sdk/components/common/raycast_hit.proto +16 -0
- package/proto/decentraland/sdk/components/mesh_collider.proto +17 -3
- package/proto/decentraland/sdk/components/pointer_events.proto +1 -9
- package/proto/decentraland/sdk/components/pointer_events_result.proto +5 -6
- package/proto/decentraland/sdk/components/raycast.proto +39 -4
- package/proto/decentraland/sdk/components/raycast_result.proto +9 -19
|
@@ -6,8 +6,12 @@ export const protobufPackage = "decentraland.sdk.components";
|
|
|
6
6
|
|
|
7
7
|
/** RaycastQueryType indicates whether the ray should stop on the first collition, or continue. */
|
|
8
8
|
export enum RaycastQueryType {
|
|
9
|
+
/** RQT_HIT_FIRST - Pick the first (not necessarily the closest) hit within the range */
|
|
9
10
|
RQT_HIT_FIRST = 0,
|
|
11
|
+
/** RQT_QUERY_ALL - Pick all hits within the range */
|
|
10
12
|
RQT_QUERY_ALL = 1,
|
|
13
|
+
/** RQT_NONE - Do not perform the raycast, only set the raycast result with empty hits */
|
|
14
|
+
RQT_NONE = 2,
|
|
11
15
|
UNRECOGNIZED = -1,
|
|
12
16
|
}
|
|
13
17
|
|
|
@@ -19,6 +23,9 @@ export function raycastQueryTypeFromJSON(object: any): RaycastQueryType {
|
|
|
19
23
|
case 1:
|
|
20
24
|
case "RQT_QUERY_ALL":
|
|
21
25
|
return RaycastQueryType.RQT_QUERY_ALL;
|
|
26
|
+
case 2:
|
|
27
|
+
case "RQT_NONE":
|
|
28
|
+
return RaycastQueryType.RQT_NONE;
|
|
22
29
|
case -1:
|
|
23
30
|
case "UNRECOGNIZED":
|
|
24
31
|
default:
|
|
@@ -32,6 +39,8 @@ export function raycastQueryTypeToJSON(object: RaycastQueryType): string {
|
|
|
32
39
|
return "RQT_HIT_FIRST";
|
|
33
40
|
case RaycastQueryType.RQT_QUERY_ALL:
|
|
34
41
|
return "RQT_QUERY_ALL";
|
|
42
|
+
case RaycastQueryType.RQT_NONE:
|
|
43
|
+
return "RQT_NONE";
|
|
35
44
|
case RaycastQueryType.UNRECOGNIZED:
|
|
36
45
|
default:
|
|
37
46
|
return "UNRECOGNIZED";
|
|
@@ -39,35 +48,74 @@ export function raycastQueryTypeToJSON(object: RaycastQueryType): string {
|
|
|
39
48
|
}
|
|
40
49
|
|
|
41
50
|
/**
|
|
51
|
+
* The PBRaycast component and PBRaycastResult are defined in https://adr.decentraland.org/adr/ADR-200
|
|
52
|
+
*
|
|
42
53
|
* The Raycast component allows scenes to request raycasting from the game engine. The results will
|
|
43
54
|
* be available in a RaycastResult component set later on the same Entity.
|
|
44
55
|
*/
|
|
45
56
|
export interface PBRaycast {
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
|
57
|
+
/** Correlation ID, defined by the scene and used internally by the scene */
|
|
58
|
+
timestamp?:
|
|
59
|
+
| number
|
|
49
60
|
| undefined;
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
/**
|
|
62
|
+
* How much to offset the starting point of the ray, relative to the entity's transform.
|
|
63
|
+
* Defaults to vec3(0,0,0)
|
|
64
|
+
*/
|
|
65
|
+
originOffset?: Vector3 | undefined;
|
|
66
|
+
direction?:
|
|
67
|
+
| { $case: "localDirection"; localDirection: Vector3 }
|
|
68
|
+
| { $case: "globalDirection"; globalDirection: Vector3 }
|
|
69
|
+
| { $case: "globalTarget"; globalTarget: Vector3 }
|
|
70
|
+
| { $case: "targetEntity"; targetEntity: number };
|
|
71
|
+
/** Maximum length of the ray in virtual meters (global space) */
|
|
55
72
|
maxDistance: number;
|
|
56
|
-
/** the RaycastQueryType behavior
|
|
73
|
+
/** the RaycastQueryType behavior */
|
|
57
74
|
queryType: RaycastQueryType;
|
|
75
|
+
/**
|
|
76
|
+
* Indicates the renderer to perform the raycast on every scene tick (ADR-148),
|
|
77
|
+
* otherwise it will be performed only once, defaults to false
|
|
78
|
+
*/
|
|
79
|
+
continuous?:
|
|
80
|
+
| boolean
|
|
81
|
+
| undefined;
|
|
82
|
+
/** Collision mask, by default all bits are 1 (0xFFFF_FFFF) */
|
|
83
|
+
collisionMask?: number | undefined;
|
|
58
84
|
}
|
|
59
85
|
|
|
60
86
|
function createBasePBRaycast(): PBRaycast {
|
|
61
|
-
return {
|
|
87
|
+
return {
|
|
88
|
+
timestamp: undefined,
|
|
89
|
+
originOffset: undefined,
|
|
90
|
+
direction: undefined,
|
|
91
|
+
maxDistance: 0,
|
|
92
|
+
queryType: 0,
|
|
93
|
+
continuous: undefined,
|
|
94
|
+
collisionMask: undefined,
|
|
95
|
+
};
|
|
62
96
|
}
|
|
63
97
|
|
|
64
98
|
export const PBRaycast = {
|
|
65
99
|
encode(message: PBRaycast, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
66
|
-
if (message.
|
|
67
|
-
|
|
100
|
+
if (message.timestamp !== undefined) {
|
|
101
|
+
writer.uint32(8).uint32(message.timestamp);
|
|
102
|
+
}
|
|
103
|
+
if (message.originOffset !== undefined) {
|
|
104
|
+
Vector3.encode(message.originOffset, writer.uint32(18).fork()).ldelim();
|
|
68
105
|
}
|
|
69
|
-
|
|
70
|
-
|
|
106
|
+
switch (message.direction?.$case) {
|
|
107
|
+
case "localDirection":
|
|
108
|
+
Vector3.encode(message.direction.localDirection, writer.uint32(50).fork()).ldelim();
|
|
109
|
+
break;
|
|
110
|
+
case "globalDirection":
|
|
111
|
+
Vector3.encode(message.direction.globalDirection, writer.uint32(26).fork()).ldelim();
|
|
112
|
+
break;
|
|
113
|
+
case "globalTarget":
|
|
114
|
+
Vector3.encode(message.direction.globalTarget, writer.uint32(58).fork()).ldelim();
|
|
115
|
+
break;
|
|
116
|
+
case "targetEntity":
|
|
117
|
+
writer.uint32(80).uint32(message.direction.targetEntity);
|
|
118
|
+
break;
|
|
71
119
|
}
|
|
72
120
|
if (message.maxDistance !== 0) {
|
|
73
121
|
writer.uint32(37).float(message.maxDistance);
|
|
@@ -75,6 +123,12 @@ export const PBRaycast = {
|
|
|
75
123
|
if (message.queryType !== 0) {
|
|
76
124
|
writer.uint32(40).int32(message.queryType);
|
|
77
125
|
}
|
|
126
|
+
if (message.continuous !== undefined) {
|
|
127
|
+
writer.uint32(64).bool(message.continuous);
|
|
128
|
+
}
|
|
129
|
+
if (message.collisionMask !== undefined) {
|
|
130
|
+
writer.uint32(72).uint32(message.collisionMask);
|
|
131
|
+
}
|
|
78
132
|
return writer;
|
|
79
133
|
},
|
|
80
134
|
|
|
@@ -85,19 +139,47 @@ export const PBRaycast = {
|
|
|
85
139
|
while (reader.pos < end) {
|
|
86
140
|
const tag = reader.uint32();
|
|
87
141
|
switch (tag >>> 3) {
|
|
142
|
+
case 1:
|
|
143
|
+
if (tag != 8) {
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
message.timestamp = reader.uint32();
|
|
148
|
+
continue;
|
|
88
149
|
case 2:
|
|
89
150
|
if (tag != 18) {
|
|
90
151
|
break;
|
|
91
152
|
}
|
|
92
153
|
|
|
93
|
-
message.
|
|
154
|
+
message.originOffset = Vector3.decode(reader, reader.uint32());
|
|
155
|
+
continue;
|
|
156
|
+
case 6:
|
|
157
|
+
if (tag != 50) {
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
message.direction = { $case: "localDirection", localDirection: Vector3.decode(reader, reader.uint32()) };
|
|
94
162
|
continue;
|
|
95
163
|
case 3:
|
|
96
164
|
if (tag != 26) {
|
|
97
165
|
break;
|
|
98
166
|
}
|
|
99
167
|
|
|
100
|
-
message.direction = Vector3.decode(reader, reader.uint32());
|
|
168
|
+
message.direction = { $case: "globalDirection", globalDirection: Vector3.decode(reader, reader.uint32()) };
|
|
169
|
+
continue;
|
|
170
|
+
case 7:
|
|
171
|
+
if (tag != 58) {
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
message.direction = { $case: "globalTarget", globalTarget: Vector3.decode(reader, reader.uint32()) };
|
|
176
|
+
continue;
|
|
177
|
+
case 10:
|
|
178
|
+
if (tag != 80) {
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
message.direction = { $case: "targetEntity", targetEntity: reader.uint32() };
|
|
101
183
|
continue;
|
|
102
184
|
case 4:
|
|
103
185
|
if (tag != 37) {
|
|
@@ -113,6 +195,20 @@ export const PBRaycast = {
|
|
|
113
195
|
|
|
114
196
|
message.queryType = reader.int32() as any;
|
|
115
197
|
continue;
|
|
198
|
+
case 8:
|
|
199
|
+
if (tag != 64) {
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
message.continuous = reader.bool();
|
|
204
|
+
continue;
|
|
205
|
+
case 9:
|
|
206
|
+
if (tag != 72) {
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
message.collisionMask = reader.uint32();
|
|
211
|
+
continue;
|
|
116
212
|
}
|
|
117
213
|
if ((tag & 7) == 4 || tag == 0) {
|
|
118
214
|
break;
|
|
@@ -124,20 +220,44 @@ export const PBRaycast = {
|
|
|
124
220
|
|
|
125
221
|
fromJSON(object: any): PBRaycast {
|
|
126
222
|
return {
|
|
127
|
-
|
|
128
|
-
|
|
223
|
+
timestamp: isSet(object.timestamp) ? Number(object.timestamp) : undefined,
|
|
224
|
+
originOffset: isSet(object.originOffset) ? Vector3.fromJSON(object.originOffset) : undefined,
|
|
225
|
+
direction: isSet(object.localDirection)
|
|
226
|
+
? { $case: "localDirection", localDirection: Vector3.fromJSON(object.localDirection) }
|
|
227
|
+
: isSet(object.globalDirection)
|
|
228
|
+
? { $case: "globalDirection", globalDirection: Vector3.fromJSON(object.globalDirection) }
|
|
229
|
+
: isSet(object.globalTarget)
|
|
230
|
+
? { $case: "globalTarget", globalTarget: Vector3.fromJSON(object.globalTarget) }
|
|
231
|
+
: isSet(object.targetEntity)
|
|
232
|
+
? { $case: "targetEntity", targetEntity: Number(object.targetEntity) }
|
|
233
|
+
: undefined,
|
|
129
234
|
maxDistance: isSet(object.maxDistance) ? Number(object.maxDistance) : 0,
|
|
130
235
|
queryType: isSet(object.queryType) ? raycastQueryTypeFromJSON(object.queryType) : 0,
|
|
236
|
+
continuous: isSet(object.continuous) ? Boolean(object.continuous) : undefined,
|
|
237
|
+
collisionMask: isSet(object.collisionMask) ? Number(object.collisionMask) : undefined,
|
|
131
238
|
};
|
|
132
239
|
},
|
|
133
240
|
|
|
134
241
|
toJSON(message: PBRaycast): unknown {
|
|
135
242
|
const obj: any = {};
|
|
136
|
-
message.
|
|
137
|
-
message.
|
|
138
|
-
(obj.
|
|
243
|
+
message.timestamp !== undefined && (obj.timestamp = Math.round(message.timestamp));
|
|
244
|
+
message.originOffset !== undefined &&
|
|
245
|
+
(obj.originOffset = message.originOffset ? Vector3.toJSON(message.originOffset) : undefined);
|
|
246
|
+
message.direction?.$case === "localDirection" && (obj.localDirection = message.direction?.localDirection
|
|
247
|
+
? Vector3.toJSON(message.direction?.localDirection)
|
|
248
|
+
: undefined);
|
|
249
|
+
message.direction?.$case === "globalDirection" && (obj.globalDirection = message.direction?.globalDirection
|
|
250
|
+
? Vector3.toJSON(message.direction?.globalDirection)
|
|
251
|
+
: undefined);
|
|
252
|
+
message.direction?.$case === "globalTarget" &&
|
|
253
|
+
(obj.globalTarget = message.direction?.globalTarget
|
|
254
|
+
? Vector3.toJSON(message.direction?.globalTarget)
|
|
255
|
+
: undefined);
|
|
256
|
+
message.direction?.$case === "targetEntity" && (obj.targetEntity = Math.round(message.direction?.targetEntity));
|
|
139
257
|
message.maxDistance !== undefined && (obj.maxDistance = message.maxDistance);
|
|
140
258
|
message.queryType !== undefined && (obj.queryType = raycastQueryTypeToJSON(message.queryType));
|
|
259
|
+
message.continuous !== undefined && (obj.continuous = message.continuous);
|
|
260
|
+
message.collisionMask !== undefined && (obj.collisionMask = Math.round(message.collisionMask));
|
|
141
261
|
return obj;
|
|
142
262
|
},
|
|
143
263
|
|
|
@@ -147,14 +267,48 @@ export const PBRaycast = {
|
|
|
147
267
|
|
|
148
268
|
fromPartial<I extends Exact<DeepPartial<PBRaycast>, I>>(object: I): PBRaycast {
|
|
149
269
|
const message = createBasePBRaycast();
|
|
150
|
-
message.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
message.direction = (object.direction !== undefined && object.direction !== null)
|
|
154
|
-
? Vector3.fromPartial(object.direction)
|
|
270
|
+
message.timestamp = object.timestamp ?? undefined;
|
|
271
|
+
message.originOffset = (object.originOffset !== undefined && object.originOffset !== null)
|
|
272
|
+
? Vector3.fromPartial(object.originOffset)
|
|
155
273
|
: undefined;
|
|
274
|
+
if (
|
|
275
|
+
object.direction?.$case === "localDirection" &&
|
|
276
|
+
object.direction?.localDirection !== undefined &&
|
|
277
|
+
object.direction?.localDirection !== null
|
|
278
|
+
) {
|
|
279
|
+
message.direction = {
|
|
280
|
+
$case: "localDirection",
|
|
281
|
+
localDirection: Vector3.fromPartial(object.direction.localDirection),
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
if (
|
|
285
|
+
object.direction?.$case === "globalDirection" &&
|
|
286
|
+
object.direction?.globalDirection !== undefined &&
|
|
287
|
+
object.direction?.globalDirection !== null
|
|
288
|
+
) {
|
|
289
|
+
message.direction = {
|
|
290
|
+
$case: "globalDirection",
|
|
291
|
+
globalDirection: Vector3.fromPartial(object.direction.globalDirection),
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
if (
|
|
295
|
+
object.direction?.$case === "globalTarget" &&
|
|
296
|
+
object.direction?.globalTarget !== undefined &&
|
|
297
|
+
object.direction?.globalTarget !== null
|
|
298
|
+
) {
|
|
299
|
+
message.direction = { $case: "globalTarget", globalTarget: Vector3.fromPartial(object.direction.globalTarget) };
|
|
300
|
+
}
|
|
301
|
+
if (
|
|
302
|
+
object.direction?.$case === "targetEntity" &&
|
|
303
|
+
object.direction?.targetEntity !== undefined &&
|
|
304
|
+
object.direction?.targetEntity !== null
|
|
305
|
+
) {
|
|
306
|
+
message.direction = { $case: "targetEntity", targetEntity: object.direction.targetEntity };
|
|
307
|
+
}
|
|
156
308
|
message.maxDistance = object.maxDistance ?? 0;
|
|
157
309
|
message.queryType = object.queryType ?? 0;
|
|
310
|
+
message.continuous = object.continuous ?? undefined;
|
|
311
|
+
message.collisionMask = object.collisionMask ?? undefined;
|
|
158
312
|
return message;
|
|
159
313
|
},
|
|
160
314
|
};
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import Long from "long";
|
|
3
2
|
import _m0 from "protobufjs/minimal";
|
|
4
3
|
import { Vector3 } from "../../common/vectors.gen";
|
|
4
|
+
import { RaycastHit } from "./common/raycast_hit.gen";
|
|
5
5
|
|
|
6
6
|
export const protobufPackage = "decentraland.sdk.components";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
+
* The PBRaycast component and PBRaycastResult are defined in https://adr.decentraland.org/adr/ADR-200
|
|
10
|
+
*
|
|
9
11
|
* The RaycastResult component is added to an Entity when the results of a previously attached
|
|
10
12
|
* Raycast component are available. It contains information about the ray and any objects it
|
|
11
13
|
* collided with.
|
|
12
14
|
*/
|
|
13
15
|
export interface PBRaycastResult {
|
|
14
|
-
/**
|
|
15
|
-
timestamp
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/** timestamp is a correlation id, copied from the PBRaycast */
|
|
17
|
+
timestamp?:
|
|
18
|
+
| number
|
|
19
|
+
| undefined;
|
|
20
|
+
/** the starting point of the ray in global coordinates */
|
|
21
|
+
globalOrigin:
|
|
18
22
|
| Vector3
|
|
19
23
|
| undefined;
|
|
20
|
-
/** the direction vector of the ray */
|
|
24
|
+
/** the direction vector of the ray in global coordinates */
|
|
21
25
|
direction:
|
|
22
26
|
| Vector3
|
|
23
27
|
| undefined;
|
|
@@ -25,45 +29,17 @@ export interface PBRaycastResult {
|
|
|
25
29
|
hits: RaycastHit[];
|
|
26
30
|
}
|
|
27
31
|
|
|
28
|
-
/** RaycastHit contains information about the intersection of a ray with a mesh. */
|
|
29
|
-
export interface RaycastHit {
|
|
30
|
-
/** Position will be relative to the scene */
|
|
31
|
-
position:
|
|
32
|
-
| Vector3
|
|
33
|
-
| undefined;
|
|
34
|
-
/** the starting point of the ray */
|
|
35
|
-
origin:
|
|
36
|
-
| Vector3
|
|
37
|
-
| undefined;
|
|
38
|
-
/** the direction vector of the ray */
|
|
39
|
-
direction:
|
|
40
|
-
| Vector3
|
|
41
|
-
| undefined;
|
|
42
|
-
/** the entry vector of the ray into the collision mesh */
|
|
43
|
-
normalHit:
|
|
44
|
-
| Vector3
|
|
45
|
-
| undefined;
|
|
46
|
-
/** the distance between the ray origin and the hit position */
|
|
47
|
-
length: number;
|
|
48
|
-
/** (unused) mesh ID if collision happened inside a GltfContainer */
|
|
49
|
-
meshName?:
|
|
50
|
-
| string
|
|
51
|
-
| undefined;
|
|
52
|
-
/** the ID of the Entity that has the impacted mesh attached */
|
|
53
|
-
entityId?: number | undefined;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
32
|
function createBasePBRaycastResult(): PBRaycastResult {
|
|
57
|
-
return { timestamp:
|
|
33
|
+
return { timestamp: undefined, globalOrigin: undefined, direction: undefined, hits: [] };
|
|
58
34
|
}
|
|
59
35
|
|
|
60
36
|
export const PBRaycastResult = {
|
|
61
37
|
encode(message: PBRaycastResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
62
|
-
if (message.timestamp !==
|
|
63
|
-
writer.uint32(8).
|
|
38
|
+
if (message.timestamp !== undefined) {
|
|
39
|
+
writer.uint32(8).uint32(message.timestamp);
|
|
64
40
|
}
|
|
65
|
-
if (message.
|
|
66
|
-
Vector3.encode(message.
|
|
41
|
+
if (message.globalOrigin !== undefined) {
|
|
42
|
+
Vector3.encode(message.globalOrigin, writer.uint32(18).fork()).ldelim();
|
|
67
43
|
}
|
|
68
44
|
if (message.direction !== undefined) {
|
|
69
45
|
Vector3.encode(message.direction, writer.uint32(26).fork()).ldelim();
|
|
@@ -86,14 +62,14 @@ export const PBRaycastResult = {
|
|
|
86
62
|
break;
|
|
87
63
|
}
|
|
88
64
|
|
|
89
|
-
message.timestamp = reader.
|
|
65
|
+
message.timestamp = reader.uint32();
|
|
90
66
|
continue;
|
|
91
67
|
case 2:
|
|
92
68
|
if (tag != 18) {
|
|
93
69
|
break;
|
|
94
70
|
}
|
|
95
71
|
|
|
96
|
-
message.
|
|
72
|
+
message.globalOrigin = Vector3.decode(reader, reader.uint32());
|
|
97
73
|
continue;
|
|
98
74
|
case 3:
|
|
99
75
|
if (tag != 26) {
|
|
@@ -120,8 +96,8 @@ export const PBRaycastResult = {
|
|
|
120
96
|
|
|
121
97
|
fromJSON(object: any): PBRaycastResult {
|
|
122
98
|
return {
|
|
123
|
-
timestamp: isSet(object.timestamp) ? Number(object.timestamp) :
|
|
124
|
-
|
|
99
|
+
timestamp: isSet(object.timestamp) ? Number(object.timestamp) : undefined,
|
|
100
|
+
globalOrigin: isSet(object.globalOrigin) ? Vector3.fromJSON(object.globalOrigin) : undefined,
|
|
125
101
|
direction: isSet(object.direction) ? Vector3.fromJSON(object.direction) : undefined,
|
|
126
102
|
hits: Array.isArray(object?.hits) ? object.hits.map((e: any) => RaycastHit.fromJSON(e)) : [],
|
|
127
103
|
};
|
|
@@ -130,7 +106,8 @@ export const PBRaycastResult = {
|
|
|
130
106
|
toJSON(message: PBRaycastResult): unknown {
|
|
131
107
|
const obj: any = {};
|
|
132
108
|
message.timestamp !== undefined && (obj.timestamp = Math.round(message.timestamp));
|
|
133
|
-
message.
|
|
109
|
+
message.globalOrigin !== undefined &&
|
|
110
|
+
(obj.globalOrigin = message.globalOrigin ? Vector3.toJSON(message.globalOrigin) : undefined);
|
|
134
111
|
message.direction !== undefined &&
|
|
135
112
|
(obj.direction = message.direction ? Vector3.toJSON(message.direction) : undefined);
|
|
136
113
|
if (message.hits) {
|
|
@@ -147,9 +124,9 @@ export const PBRaycastResult = {
|
|
|
147
124
|
|
|
148
125
|
fromPartial<I extends Exact<DeepPartial<PBRaycastResult>, I>>(object: I): PBRaycastResult {
|
|
149
126
|
const message = createBasePBRaycastResult();
|
|
150
|
-
message.timestamp = object.timestamp ??
|
|
151
|
-
message.
|
|
152
|
-
? Vector3.fromPartial(object.
|
|
127
|
+
message.timestamp = object.timestamp ?? undefined;
|
|
128
|
+
message.globalOrigin = (object.globalOrigin !== undefined && object.globalOrigin !== null)
|
|
129
|
+
? Vector3.fromPartial(object.globalOrigin)
|
|
153
130
|
: undefined;
|
|
154
131
|
message.direction = (object.direction !== undefined && object.direction !== null)
|
|
155
132
|
? Vector3.fromPartial(object.direction)
|
|
@@ -159,179 +136,6 @@ export const PBRaycastResult = {
|
|
|
159
136
|
},
|
|
160
137
|
};
|
|
161
138
|
|
|
162
|
-
function createBaseRaycastHit(): RaycastHit {
|
|
163
|
-
return {
|
|
164
|
-
position: undefined,
|
|
165
|
-
origin: undefined,
|
|
166
|
-
direction: undefined,
|
|
167
|
-
normalHit: undefined,
|
|
168
|
-
length: 0,
|
|
169
|
-
meshName: undefined,
|
|
170
|
-
entityId: undefined,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export const RaycastHit = {
|
|
175
|
-
encode(message: RaycastHit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
176
|
-
if (message.position !== undefined) {
|
|
177
|
-
Vector3.encode(message.position, writer.uint32(10).fork()).ldelim();
|
|
178
|
-
}
|
|
179
|
-
if (message.origin !== undefined) {
|
|
180
|
-
Vector3.encode(message.origin, writer.uint32(18).fork()).ldelim();
|
|
181
|
-
}
|
|
182
|
-
if (message.direction !== undefined) {
|
|
183
|
-
Vector3.encode(message.direction, writer.uint32(26).fork()).ldelim();
|
|
184
|
-
}
|
|
185
|
-
if (message.normalHit !== undefined) {
|
|
186
|
-
Vector3.encode(message.normalHit, writer.uint32(34).fork()).ldelim();
|
|
187
|
-
}
|
|
188
|
-
if (message.length !== 0) {
|
|
189
|
-
writer.uint32(45).float(message.length);
|
|
190
|
-
}
|
|
191
|
-
if (message.meshName !== undefined) {
|
|
192
|
-
writer.uint32(50).string(message.meshName);
|
|
193
|
-
}
|
|
194
|
-
if (message.entityId !== undefined) {
|
|
195
|
-
writer.uint32(56).int64(message.entityId);
|
|
196
|
-
}
|
|
197
|
-
return writer;
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): RaycastHit {
|
|
201
|
-
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
202
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
203
|
-
const message = createBaseRaycastHit();
|
|
204
|
-
while (reader.pos < end) {
|
|
205
|
-
const tag = reader.uint32();
|
|
206
|
-
switch (tag >>> 3) {
|
|
207
|
-
case 1:
|
|
208
|
-
if (tag != 10) {
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
message.position = Vector3.decode(reader, reader.uint32());
|
|
213
|
-
continue;
|
|
214
|
-
case 2:
|
|
215
|
-
if (tag != 18) {
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
message.origin = Vector3.decode(reader, reader.uint32());
|
|
220
|
-
continue;
|
|
221
|
-
case 3:
|
|
222
|
-
if (tag != 26) {
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
message.direction = Vector3.decode(reader, reader.uint32());
|
|
227
|
-
continue;
|
|
228
|
-
case 4:
|
|
229
|
-
if (tag != 34) {
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
message.normalHit = Vector3.decode(reader, reader.uint32());
|
|
234
|
-
continue;
|
|
235
|
-
case 5:
|
|
236
|
-
if (tag != 45) {
|
|
237
|
-
break;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
message.length = reader.float();
|
|
241
|
-
continue;
|
|
242
|
-
case 6:
|
|
243
|
-
if (tag != 50) {
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
message.meshName = reader.string();
|
|
248
|
-
continue;
|
|
249
|
-
case 7:
|
|
250
|
-
if (tag != 56) {
|
|
251
|
-
break;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
message.entityId = longToNumber(reader.int64() as Long);
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
257
|
-
if ((tag & 7) == 4 || tag == 0) {
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
reader.skipType(tag & 7);
|
|
261
|
-
}
|
|
262
|
-
return message;
|
|
263
|
-
},
|
|
264
|
-
|
|
265
|
-
fromJSON(object: any): RaycastHit {
|
|
266
|
-
return {
|
|
267
|
-
position: isSet(object.position) ? Vector3.fromJSON(object.position) : undefined,
|
|
268
|
-
origin: isSet(object.origin) ? Vector3.fromJSON(object.origin) : undefined,
|
|
269
|
-
direction: isSet(object.direction) ? Vector3.fromJSON(object.direction) : undefined,
|
|
270
|
-
normalHit: isSet(object.normalHit) ? Vector3.fromJSON(object.normalHit) : undefined,
|
|
271
|
-
length: isSet(object.length) ? Number(object.length) : 0,
|
|
272
|
-
meshName: isSet(object.meshName) ? String(object.meshName) : undefined,
|
|
273
|
-
entityId: isSet(object.entityId) ? Number(object.entityId) : undefined,
|
|
274
|
-
};
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
toJSON(message: RaycastHit): unknown {
|
|
278
|
-
const obj: any = {};
|
|
279
|
-
message.position !== undefined && (obj.position = message.position ? Vector3.toJSON(message.position) : undefined);
|
|
280
|
-
message.origin !== undefined && (obj.origin = message.origin ? Vector3.toJSON(message.origin) : undefined);
|
|
281
|
-
message.direction !== undefined &&
|
|
282
|
-
(obj.direction = message.direction ? Vector3.toJSON(message.direction) : undefined);
|
|
283
|
-
message.normalHit !== undefined &&
|
|
284
|
-
(obj.normalHit = message.normalHit ? Vector3.toJSON(message.normalHit) : undefined);
|
|
285
|
-
message.length !== undefined && (obj.length = message.length);
|
|
286
|
-
message.meshName !== undefined && (obj.meshName = message.meshName);
|
|
287
|
-
message.entityId !== undefined && (obj.entityId = Math.round(message.entityId));
|
|
288
|
-
return obj;
|
|
289
|
-
},
|
|
290
|
-
|
|
291
|
-
create<I extends Exact<DeepPartial<RaycastHit>, I>>(base?: I): RaycastHit {
|
|
292
|
-
return RaycastHit.fromPartial(base ?? {});
|
|
293
|
-
},
|
|
294
|
-
|
|
295
|
-
fromPartial<I extends Exact<DeepPartial<RaycastHit>, I>>(object: I): RaycastHit {
|
|
296
|
-
const message = createBaseRaycastHit();
|
|
297
|
-
message.position = (object.position !== undefined && object.position !== null)
|
|
298
|
-
? Vector3.fromPartial(object.position)
|
|
299
|
-
: undefined;
|
|
300
|
-
message.origin = (object.origin !== undefined && object.origin !== null)
|
|
301
|
-
? Vector3.fromPartial(object.origin)
|
|
302
|
-
: undefined;
|
|
303
|
-
message.direction = (object.direction !== undefined && object.direction !== null)
|
|
304
|
-
? Vector3.fromPartial(object.direction)
|
|
305
|
-
: undefined;
|
|
306
|
-
message.normalHit = (object.normalHit !== undefined && object.normalHit !== null)
|
|
307
|
-
? Vector3.fromPartial(object.normalHit)
|
|
308
|
-
: undefined;
|
|
309
|
-
message.length = object.length ?? 0;
|
|
310
|
-
message.meshName = object.meshName ?? undefined;
|
|
311
|
-
message.entityId = object.entityId ?? undefined;
|
|
312
|
-
return message;
|
|
313
|
-
},
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
declare var self: any | undefined;
|
|
317
|
-
declare var window: any | undefined;
|
|
318
|
-
declare var global: any | undefined;
|
|
319
|
-
var tsProtoGlobalThis: any = (() => {
|
|
320
|
-
if (typeof globalThis !== "undefined") {
|
|
321
|
-
return globalThis;
|
|
322
|
-
}
|
|
323
|
-
if (typeof self !== "undefined") {
|
|
324
|
-
return self;
|
|
325
|
-
}
|
|
326
|
-
if (typeof window !== "undefined") {
|
|
327
|
-
return window;
|
|
328
|
-
}
|
|
329
|
-
if (typeof global !== "undefined") {
|
|
330
|
-
return global;
|
|
331
|
-
}
|
|
332
|
-
throw "Unable to locate global object";
|
|
333
|
-
})();
|
|
334
|
-
|
|
335
139
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
336
140
|
|
|
337
141
|
export type DeepPartial<T> = T extends Builtin ? T
|
|
@@ -344,18 +148,6 @@ type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
|
344
148
|
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
345
149
|
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
346
150
|
|
|
347
|
-
function longToNumber(long: Long): number {
|
|
348
|
-
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
349
|
-
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
350
|
-
}
|
|
351
|
-
return long.toNumber();
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
if (_m0.util.Long !== Long) {
|
|
355
|
-
_m0.util.Long = Long as any;
|
|
356
|
-
_m0.configure();
|
|
357
|
-
}
|
|
358
|
-
|
|
359
151
|
function isSet(value: any): boolean {
|
|
360
152
|
return value !== null && value !== undefined;
|
|
361
153
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/protocol",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-4493564897.commit-c858f8a",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"out-js",
|
|
27
27
|
"public"
|
|
28
28
|
],
|
|
29
|
-
"commit": "
|
|
29
|
+
"commit": "c858f8a15323fd86a18474c8b650deea28507d3b"
|
|
30
30
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package decentraland.sdk.components.common;
|
|
4
|
+
import "decentraland/common/vectors.proto";
|
|
5
|
+
|
|
6
|
+
// RaycastHit contains information about the intersection of a ray with a mesh.
|
|
7
|
+
message RaycastHit {
|
|
8
|
+
// Position will be relative to the scene
|
|
9
|
+
decentraland.common.Vector3 position = 1; // the intersection point in global coordinates
|
|
10
|
+
decentraland.common.Vector3 global_origin = 2; // the starting point of the ray in global coordinates
|
|
11
|
+
decentraland.common.Vector3 direction = 3; // the direction vector of the ray in global coordinates
|
|
12
|
+
decentraland.common.Vector3 normal_hit = 4; // normal of the hit surface in global coordinates
|
|
13
|
+
float length = 5; // the distance between the ray origin and the hit position
|
|
14
|
+
optional string mesh_name = 6; // mesh name, if collision happened inside a GltfContainer
|
|
15
|
+
optional uint32 entity_id = 7; // the ID of the Entity that has the impacted mesh attached
|
|
16
|
+
}
|