@jack120/test 0.2.0 → 0.2.1

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.
Files changed (57) hide show
  1. package/dist/index.d.ts +1140 -0
  2. package/package.json +4 -1
  3. package/.gitmodules +0 -3
  4. package/.prettierrc +0 -6
  5. package/.vscode/c_cpp_properties.json +0 -14
  6. package/.vscode/launch.json +0 -24
  7. package/.vscode/settings.json +0 -8
  8. package/CMakeLists.txt +0 -52
  9. package/adamas-config.json +0 -5
  10. package/external/CMakeLists.txt +0 -1
  11. package/external/Unity-NodeJS-RPC/CMakeLists.txt +0 -13
  12. package/external/Unity-NodeJS-RPC/README.md +0 -1
  13. package/external/Unity-NodeJS-RPC/RpcClient.cpp +0 -265
  14. package/external/Unity-NodeJS-RPC/include/RpcClient.h +0 -118
  15. package/external/Unity-NodeJS-RPC/main.cpp +0 -76
  16. package/external/Unity-NodeJS-RPC/nlohmann/json.hpp +0 -25526
  17. package/external/Unity-NodeJS-RPC/server/Program.cs +0 -52
  18. package/external/Unity-NodeJS-RPC/server/json.cs +0 -66
  19. package/external/Unity-NodeJS-RPC/server/rpc.cs +0 -369
  20. package/external/Unity-NodeJS-RPC/server/sample1.csproj +0 -10
  21. package/external/Unity-NodeJS-RPC/server/sample1.sln +0 -24
  22. package/external/Unity-NodeJS-RPC/server/unity/RpcUnity.cs.txt +0 -60
  23. package/index.ts +0 -36
  24. package/library/adamas-types.d.ts +0 -70
  25. package/library/debug.ts +0 -7
  26. package/library/device.ts +0 -279
  27. package/library/entity.ts +0 -35
  28. package/library/index.ts +0 -19
  29. package/library/interaction/interaction.ts +0 -281
  30. package/library/networking/state-sync.ts +0 -62
  31. package/library/physics/collider.ts +0 -252
  32. package/library/physics/rigidbody.ts +0 -119
  33. package/library/render/camera.ts +0 -172
  34. package/library/render/light.ts +0 -169
  35. package/library/render/material.ts +0 -258
  36. package/library/render/mesh.ts +0 -208
  37. package/library/render/primitives.ts +0 -76
  38. package/library/render/renderable.ts +0 -137
  39. package/library/render/renderer.ts +0 -124
  40. package/library/render/scene.ts +0 -89
  41. package/library/render/texture.ts +0 -247
  42. package/library/render/transform.ts +0 -259
  43. package/library/rpc.ts +0 -81
  44. package/library/utilities/base64.ts +0 -63
  45. package/loader-template.ts +0 -419
  46. package/native.cc +0 -111
  47. package/project.adamas.json +0 -457
  48. package/rusk.glb +0 -0
  49. package/samples/device-sample.ts +0 -30
  50. package/samples/interaction-sample.ts +0 -134
  51. package/samples/physics-sample.ts +0 -39
  52. package/samples/rendering-sample.ts +0 -88
  53. package/samples/spawn-cube.ts +0 -422
  54. package/samples/state-sync-sample.ts +0 -25
  55. package/tsconfig.json +0 -20
  56. /package/{library → dist}/native-bindings-osx.node +0 -0
  57. /package/{library → dist}/native-bindings-win.node +0 -0
@@ -1,124 +0,0 @@
1
- import { MaterialManager } from "../render/material";
2
- import { TextureManager } from "../render/texture";
3
- import { SceneManager } from "../render/scene";
4
-
5
- export class RendererManager {
6
- // ------------------------------------------------------------
7
- // Camera / XR
8
- // ------------------------------------------------------------
9
-
10
- /**
11
- * Filament: Renderer::getDefaultCameraEntity()
12
- * Unity RPC not yet implemented; please register a CameraManager method.
13
- * @returns The default camera entity handle
14
- */
15
- static GetDefaultCameraEntity(): number {
16
- console.warn("GetDefaultCameraEntity(): Unity RPC not available");
17
- return -1;
18
- }
19
-
20
- /**
21
- * Filament: Renderer::getXRCameras()
22
- * Unity RPC not yet implemented.
23
- * @returns Array of XR camera entity handles
24
- */
25
- static GetXRCameras(): number[] {
26
- console.warn("GetXRCameras(): Unity RPC not available");
27
- return [];
28
- }
29
-
30
- // ------------------------------------------------------------
31
- // Material / Skybox / Indirect Light
32
- // ------------------------------------------------------------
33
-
34
- /**
35
- * Destroy a material instance (mimics Filament::Renderer::destroyMaterialInstance)
36
- * @param instanceHandle The material instance handle to destroy
37
- * @returns boolean indicating success
38
- */
39
- static DestroyMaterialInstance(instanceHandle: number): boolean {
40
- return MaterialManager.Destroy(instanceHandle);
41
- }
42
-
43
- /**
44
- * Destroy a render-target (in Unity, render textures)
45
- * @param rtHandle The render target handle to destroy
46
- * @returns boolean indicating success
47
- */
48
- static DestroyRenderTarget(rtHandle: number): boolean {
49
- return TextureManager.Destroy(rtHandle);
50
- }
51
-
52
- /**
53
- * Destroy a skybox (in Unity, just a material)
54
- * @param skyboxMatHandle The skybox material handle to destroy
55
- * @returns boolean indicating success
56
- */
57
- static DestroySkybox(skyboxMatHandle: number): boolean {
58
- return MaterialManager.Destroy(skyboxMatHandle);
59
- }
60
-
61
- /**
62
- * Destroy an indirect light (no direct Unity equivalent)
63
- * @param ilHandle The indirect light handle to destroy
64
- * @returns boolean indicating success
65
- */
66
- static DestroyIndirectLight(ilHandle: number): boolean {
67
- console.warn("DestroyIndirectLight(): no Unity RPC equivalent");
68
- return false;
69
- }
70
-
71
- // ------------------------------------------------------------
72
- // Scene-level convenience
73
- // ------------------------------------------------------------
74
-
75
- /**
76
- * Wraps Scene_SetSkybox
77
- * @param sceneHandle The scene handle
78
- * @param skyboxMatHandle The skybox material handle
79
- * @returns boolean indicating success
80
- */
81
- static SetSkybox(sceneHandle: number, skyboxMatHandle: number): boolean {
82
- return SceneManager.SetSkybox(sceneHandle, skyboxMatHandle);
83
- }
84
-
85
- /**
86
- * Wraps Scene_SetAmbientLight
87
- * @param sceneHandle The scene handle
88
- * @param r Red component (0-1)
89
- * @param g Green component (0-1)
90
- * @param b Blue component (0-1)
91
- * @param intensity The ambient light intensity
92
- * @returns boolean indicating success
93
- */
94
- static SetAmbientLight(
95
- sceneHandle: number,
96
- r: number,
97
- g: number,
98
- b: number,
99
- intensity: number,
100
- ): boolean {
101
- return SceneManager.SetAmbientLight(sceneHandle, r, g, b, intensity);
102
- }
103
-
104
- /**
105
- * Wraps Scene_SetFog
106
- * @param sceneHandle The scene handle
107
- * @param enabled Whether fog is enabled
108
- * @param mode The fog mode
109
- * @param density The fog density
110
- * @param start The fog start distance
111
- * @param end The fog end distance
112
- * @returns boolean indicating success
113
- */
114
- static SetFog(
115
- sceneHandle: number,
116
- enabled: boolean,
117
- mode: number,
118
- density: number,
119
- start: number,
120
- end: number,
121
- ): boolean {
122
- return SceneManager.SetFog(sceneHandle, enabled, mode, density, start, end);
123
- }
124
- }
@@ -1,89 +0,0 @@
1
- import { RpcClient } from "../rpc";
2
-
3
- export type SceneHandle = number;
4
-
5
- // NOTE: the following are not supported compared to legacy code:
6
- // - A dedicated "SkyboxBuilder" or multiple‐camera viewports (Unity handles those internally)
7
-
8
- // includes skybox as well
9
- export class SceneManager {
10
- /**
11
- * Get the default scene handle
12
- * @returns The default scene handle
13
- */
14
- static GetDefault(): SceneHandle {
15
- return Number(RpcClient.Call("Scene_GetDefault", {}));
16
- }
17
-
18
- /**
19
- * Set the skybox for the scene
20
- * @param sceneHandle The scene handle
21
- * @param skyboxHandle The skybox material handle
22
- * @returns boolean indicating success
23
- */
24
- static SetSkybox(sceneHandle: SceneHandle, skyboxHandle: number): boolean {
25
- return Boolean(
26
- RpcClient.Call("Scene_SetSkybox", {
27
- sceneHandle,
28
- skyboxHandle,
29
- }),
30
- );
31
- }
32
-
33
- /**
34
- * Set the ambient light for the scene
35
- * @param sceneHandle The scene handle
36
- * @param r Red component (0-1)
37
- * @param g Green component (0-1)
38
- * @param b Blue component (0-1)
39
- * @param intensity The ambient light intensity
40
- * @returns boolean indicating success
41
- */
42
- static SetAmbientLight(
43
- sceneHandle: SceneHandle,
44
- r: number,
45
- g: number,
46
- b: number,
47
- intensity: number,
48
- ): boolean {
49
- return Boolean(
50
- RpcClient.Call("Scene_SetAmbientLight", {
51
- sceneHandle,
52
- r,
53
- g,
54
- b,
55
- intensity,
56
- }),
57
- );
58
- }
59
-
60
- /**
61
- * Set the fog parameters for the scene
62
- * @param sceneHandle The scene handle
63
- * @param enabled Whether fog is enabled
64
- * @param mode The fog mode
65
- * @param density The fog density
66
- * @param start The fog start distance
67
- * @param end The fog end distance
68
- * @returns boolean indicating success
69
- */
70
- static SetFog(
71
- sceneHandle: SceneHandle,
72
- enabled: boolean,
73
- mode: number,
74
- density: number,
75
- start: number,
76
- end: number,
77
- ): boolean {
78
- return Boolean(
79
- RpcClient.Call("Scene_SetFog", {
80
- sceneHandle,
81
- enabled,
82
- mode,
83
- density,
84
- start,
85
- end,
86
- }),
87
- );
88
- }
89
- }
@@ -1,247 +0,0 @@
1
- import { RpcClient } from "../rpc";
2
- import { base64Encode } from "../utilities/base64";
3
- import { MaterialHandle } from "./material";
4
-
5
- export type TextureHandle = number;
6
-
7
- // NOTE: the following are not supported compared to legacy code:
8
- // - Filament's TextureBuilder, Swizzle, GenerateMipmaps, PixelBufferDescriptor
9
-
10
- export enum TextureFormat {
11
- //
12
- // Summary:
13
- // Alpha-only texture format, 8 bit integer.
14
- Alpha8 = 1,
15
- //
16
- // Summary:
17
- // A 16 bits/pixel texture format. Texture stores color with an alpha channel.
18
- ARGB4444 = 2,
19
- //
20
- // Summary:
21
- // Three channel (RGB) texture format, 8-bits unsigned integer per channel.
22
- RGB24 = 3,
23
- //
24
- // Summary:
25
- // Four channel (RGBA) texture format, 8-bits unsigned integer per channel.
26
- RGBA32 = 4,
27
- //
28
- // Summary:
29
- // Color with alpha texture format, 8-bits per channel.
30
- ARGB32 = 5,
31
- //
32
- // Summary:
33
- // A 16 bit color texture format.
34
- RGB565 = 7,
35
- //
36
- // Summary:
37
- // Single channel (R) texture format, 16-bits unsigned integer.
38
- R16 = 9,
39
- //
40
- // Summary:
41
- // Compressed color texture format.
42
- DXT1 = 10,
43
- //
44
- // Summary:
45
- // Compressed color with alpha channel texture format.
46
- DXT5 = 12,
47
- }
48
-
49
- export class TextureManager {
50
- /**
51
- * Create a 2D texture
52
- * @param width The texture width
53
- * @param height The texture height
54
- * @param format The texture format
55
- * @returns The texture handle
56
- */
57
- static Create2D(
58
- width: number,
59
- height: number,
60
- format: TextureFormat,
61
- ): TextureHandle {
62
- return Number(
63
- RpcClient.Call("Texture_Create2D", {
64
- width,
65
- height,
66
- format,
67
- clientId: RpcClient.GetClientId(),
68
- }),
69
- );
70
- }
71
-
72
- /**
73
- * Create a 2D texture and attach it to a material
74
- * @param width The texture width
75
- * @param height The texture height
76
- * @param format The texture format
77
- * @param materialHandle The material handle to attach to
78
- * @param propertyName The material property name
79
- * @returns The texture handle
80
- */
81
- static Create2DForMaterial(
82
- width: number,
83
- height: number,
84
- format: TextureFormat,
85
- materialHandle: MaterialHandle,
86
- propertyName: string,
87
- ): TextureHandle {
88
- const textureHandle = Number(
89
- RpcClient.Call("Texture_Create2D", {
90
- width,
91
- height,
92
- format,
93
- clientId: RpcClient.GetClientId(),
94
- }),
95
- );
96
- RpcClient.Call("Material_SetTexture", {
97
- materialHandle: materialHandle,
98
- propertyName: propertyName,
99
- textureHandle: textureHandle,
100
- });
101
- return textureHandle;
102
- }
103
-
104
- /**
105
- * Create a render texture
106
- * @param width The texture width
107
- * @param height The texture height
108
- * @param depth The texture depth
109
- * @param format The texture format
110
- * @returns The texture handle
111
- */
112
- static CreateRenderTexture(
113
- width: number,
114
- height: number,
115
- depth: number,
116
- format: TextureFormat,
117
- ): TextureHandle {
118
- return Number(
119
- RpcClient.Call("Texture_CreateRenderTexture", {
120
- width,
121
- height,
122
- depth,
123
- format,
124
- clientId: RpcClient.GetClientId(),
125
- }),
126
- );
127
- }
128
-
129
- /**
130
- * Destroy a texture
131
- * @param handle The texture handle to destroy
132
- * @returns boolean indicating success
133
- */
134
- static Destroy(handle: TextureHandle): boolean {
135
- return Boolean(
136
- RpcClient.Call("Texture_Destroy", { textureHandle: handle }),
137
- );
138
- }
139
-
140
- /**
141
- * Set raw RGBA iamge for the texture
142
- * @param handle The texture handle
143
- * @param rgbaDataJson RGBA values
144
- * @param width The texture width
145
- * @param height The texture height
146
- * @returns boolean indicating success
147
- */
148
- static LoadRawTextureData(
149
- handle: TextureHandle,
150
- base64Rgba: ArrayBufferLike,
151
- width: number,
152
- height: number,
153
- ): boolean {
154
- const base64String = base64Encode(base64Rgba);
155
- return Boolean(
156
- RpcClient.Call("Texture_LoadRawTextureData", {
157
- textureHandle: handle,
158
- base64Rgba: base64String,
159
- width,
160
- height,
161
- }),
162
- );
163
- }
164
-
165
- /**
166
- * Loads PNG/JPG image byte array into a texture.
167
- * @param handle The texture handle
168
- * @param imageDataJson JSON string with comma-separated RGBA values
169
- * @returns boolean indicating success
170
- */
171
- static LoadImage(handle: TextureHandle, image: ArrayBufferLike): boolean {
172
- const base64Image = base64Encode(image);
173
-
174
- return Boolean(
175
- RpcClient.Call("Texture_LoadImage", {
176
- textureHandle: handle,
177
- base64Image,
178
- }),
179
- );
180
- }
181
-
182
- /**
183
- * Loads PNG/JPG image byte array into a texture.
184
- * @param handle The texture handle
185
- * @param imageDataJson JSON string with comma-separated RGBA values
186
- * @returns boolean indicating success
187
- */
188
- static LoadImageBase64(handle: TextureHandle, base64Image: string): boolean {
189
- return Boolean(
190
- RpcClient.Call("Texture_LoadImage", {
191
- textureHandle: handle,
192
- base64Image,
193
- }),
194
- );
195
- }
196
-
197
- /**
198
- * Set the filter mode for the texture
199
- * @param handle The texture handle
200
- * @param mode The filter mode
201
- * @returns boolean indicating success
202
- */
203
- static SetFilterMode(
204
- handle: TextureHandle,
205
- mode: TextureFilterMode,
206
- ): boolean {
207
- return Boolean(
208
- RpcClient.Call("Texture_SetFilterMode", {
209
- textureHandle: handle,
210
- filterMode: mode,
211
- }),
212
- );
213
- }
214
-
215
- /**
216
- * Set the wrap mode for the texture
217
- * @param handle The texture handle
218
- * @param wrapMode The wrap mode
219
- * @returns boolean indicating success
220
- */
221
- static SetWrapMode(
222
- handle: TextureHandle,
223
- wrapMode: TextureWrapMode,
224
- ): boolean {
225
- return Boolean(
226
- RpcClient.Call("Texture_SetWrapMode", {
227
- textureHandle: handle,
228
- wrapMode,
229
- }),
230
- );
231
- }
232
- }
233
-
234
- export enum TextureFilterMode {
235
- NEAREST = 0,
236
- LINEAR = 1,
237
- NEAREST_MIPMAP_NEAREST = 2,
238
- LINEAR_MIPMAP_NEAREST = 3,
239
- NEAREST_MIPMAP_LINEAR = 4,
240
- LINEAR_MIPMAP_LINEAR = 5,
241
- }
242
-
243
- export enum TextureWrapMode {
244
- CLAMP_TO_EDGE = 0,
245
- REPEAT = 1,
246
- MIRRORED_REPEAT = 2,
247
- }
@@ -1,259 +0,0 @@
1
- import { RpcClient } from "../rpc";
2
- import { Entity } from "../entity";
3
- import { mat4, quat, vec3 } from "gl-matrix";
4
-
5
- /**
6
- * Wrapper for Unity Transform RPCs.
7
- * Provides strongly-typed parameters and returns.
8
- */
9
- export class TransformManager {
10
- /**
11
- * Checks if the entity has a Transform component.
12
- * @param entity The entity to check
13
- * @returns boolean indicating if transform component exists
14
- */
15
- static HasComponent(entity: Entity): boolean {
16
- return Boolean(
17
- RpcClient.Call("Transform_HasComponent", { entityHandle: entity }),
18
- );
19
- }
20
-
21
- /**
22
- * Sets the world transform given a 16-element row-major matrix.
23
- * Transposes to column-major and flips Z-axis for Unity.
24
- * TODO: double check if this is correct, what are we using internally?
25
- * Use the coords provided by gl matrix or unity.
26
- * @param entity The entity with the transform component
27
- * @param srcMatrix The source transformation matrix
28
- * @returns boolean indicating success
29
- */
30
- static SetTransform(entity: Entity, srcMatrix: mat4): boolean {
31
- const colMaj: number[] = new Array(16);
32
- for (let row = 0; row < 4; row++) {
33
- for (let col = 0; col < 4; col++) {
34
- let val = srcMatrix[row * 4 + col];
35
- if (col === 2) val = -val; // flip Z-axis
36
- colMaj[col * 4 + row] = val;
37
- }
38
- }
39
- const matrixJson = colMaj.join(",");
40
- return Boolean(
41
- RpcClient.Call("Transform_SetTransform", {
42
- entityHandle: entity,
43
- matrixJson,
44
- }),
45
- );
46
- }
47
-
48
- /**
49
- * Retrieves the world transform matrix (column-major).
50
- * @param entity The entity with the transform component
51
- * @returns The transformation matrix
52
- */
53
- static GetTransform(entity: Entity): mat4 {
54
- const result = RpcClient.Call("Transform_GetTransform", {
55
- entityHandle: entity,
56
- }) as string;
57
- const nums = result.split(",").map((j) => parseFloat(j));
58
-
59
- if (nums.length !== 16) {
60
- throw new Error(`Invalid transform data (${nums.length} elements)`);
61
- }
62
- return mat4.fromValues(
63
- nums[0],
64
- nums[1],
65
- nums[2],
66
- nums[3],
67
- nums[4],
68
- nums[5],
69
- nums[6],
70
- nums[7],
71
- nums[8],
72
- nums[9],
73
- nums[10],
74
- nums[11],
75
- nums[12],
76
- nums[13],
77
- nums[14],
78
- nums[15],
79
- );
80
- }
81
-
82
- /**
83
- * Sets this entity's parent transform.
84
- * @param entity The entity with the transform component
85
- * @param parent The parent entity
86
- * @returns boolean indicating success
87
- */
88
- static SetParent(entity: Entity, parent: Entity): boolean {
89
- return Boolean(
90
- RpcClient.Call("Transform_SetParent", {
91
- entityHandle: entity,
92
- parentHandle: parent,
93
- }),
94
- );
95
- }
96
-
97
- /**
98
- * Gets the parent entity handle, or -1 if none.
99
- * @param entity The entity with the transform component
100
- * @returns The parent entity handle
101
- */
102
- static GetParent(entity: Entity): Entity {
103
- return Number(
104
- RpcClient.Call("Transform_GetParent", { entityHandle: entity }),
105
- );
106
- }
107
-
108
- /**
109
- * Sets world position vector.
110
- * @param entity The entity with the transform component
111
- * @param pos The position vector
112
- * @returns boolean indicating success
113
- */
114
- static SetWorldPosition(entity: Entity, pos: vec3): boolean {
115
- return Boolean(
116
- RpcClient.Call("Transform_SetWorldPosition", {
117
- entityHandle: entity,
118
- x: pos[0],
119
- y: pos[1],
120
- z: pos[2],
121
- }),
122
- );
123
- }
124
-
125
- /**
126
- * Sets local position vector.
127
- * @param entity The entity with the transform component
128
- * @param pos The position vector
129
- * @returns boolean indicating success
130
- */
131
- static SetLocalPosition(entity: Entity, pos: vec3): boolean {
132
- return Boolean(
133
- RpcClient.Call("Transform_SetLocalPosition", {
134
- entityHandle: entity,
135
- x: pos[0],
136
- y: pos[1],
137
- z: pos[2],
138
- }),
139
- );
140
- }
141
-
142
- /**
143
- * Gets world position vector.
144
- * @param entity The entity with the transform component
145
- * @returns The position vector
146
- */
147
- static GetWorldPosition(entity: Entity): vec3 {
148
- const data = RpcClient.Call("Transform_GetWorldPosition", {
149
- entityHandle: entity,
150
- }) as string;
151
- const [x, y, z] = data.split(",").map((j) => parseFloat(j));
152
- return vec3.fromValues(x, y, z);
153
- }
154
-
155
- /**
156
- * Gets local position vector.
157
- * @param entity The entity with the transform component
158
- * @returns The position vector
159
- */
160
- static GetLocalPosition(entity: Entity): vec3 {
161
- const data = RpcClient.Call("Transform_GetLocalPosition", {
162
- entityHandle: entity,
163
- }) as string;
164
- const [x, y, z] = data.split(",").map((j) => parseFloat(j));
165
- return vec3.fromValues(x, y, z);
166
- }
167
-
168
- /**
169
- * Sets world rotation quaternion.
170
- * @param entity The entity with the transform component
171
- * @param quat The rotation quaternion [x, y, z, w]
172
- * @returns boolean indicating success
173
- */
174
- static SetWorldRotation(entity: Entity, quat: quat): boolean {
175
- return Boolean(
176
- RpcClient.Call("Transform_SetWorldRotation", {
177
- entityHandle: entity,
178
- x: quat[0],
179
- y: quat[1],
180
- z: quat[2],
181
- w: quat[3],
182
- }),
183
- );
184
- }
185
-
186
- /**
187
- * Sets local rotation quaternion.
188
- * @param entity The entity with the transform component
189
- * @param quat The rotation quaternion [x, y, z, w]
190
- * @returns boolean indicating success
191
- */
192
- static SetLocalRotation(entity: Entity, quat: quat): boolean {
193
- return Boolean(
194
- RpcClient.Call("Transform_SetLocalRotation", {
195
- entityHandle: entity,
196
- x: quat[0],
197
- y: quat[1],
198
- z: quat[2],
199
- w: quat[3],
200
- }),
201
- );
202
- }
203
-
204
- /**
205
- * Gets local rotation quaternion.
206
- * @param entity The entity with the transform component
207
- * @returns The rotation quaternion
208
- */
209
- static GetWorldRotation(entity: Entity): quat {
210
- const data = RpcClient.Call("Transform_GetWorldRotation", {
211
- entityHandle: entity,
212
- }) as string;
213
- const [x, y, z, w] = data.split(",").map((j) => parseFloat(j));
214
- return quat.fromValues(x, y, z, w);
215
- }
216
-
217
- /**
218
- * Gets local rotation quaternion.
219
- * @param entity The entity with the transform component
220
- * @returns The rotation quaternion
221
- */
222
- static GetLocalRotation(entity: Entity): quat {
223
- const data = RpcClient.Call("Transform_GetLocalRotation", {
224
- entityHandle: entity,
225
- }) as string;
226
- const [x, y, z, w] = data.split(",").map((j) => parseFloat(j));
227
- return quat.fromValues(x, y, z, w);
228
- }
229
-
230
- /**
231
- * Sets local scale vector.
232
- * @param entity The entity with the transform component
233
- * @param scale The scale vector
234
- * @returns boolean indicating success
235
- */
236
- static SetLocalScale(entity: Entity, scale: vec3): boolean {
237
- return Boolean(
238
- RpcClient.Call("Transform_SetLocalScale", {
239
- entityHandle: entity,
240
- x: scale[0],
241
- y: scale[1],
242
- z: scale[2],
243
- }),
244
- );
245
- }
246
-
247
- /**
248
- * Gets local scale vector.
249
- * @param entity The entity with the transform component
250
- * @returns The position vector
251
- */
252
- static GetLocalScale(entity: Entity): vec3 {
253
- const data = RpcClient.Call("Transform_GetLocalScale", {
254
- entityHandle: entity,
255
- }) as string;
256
- const [x, y, z] = data.split(",").map((j) => parseFloat(j));
257
- return vec3.fromValues(x, y, z);
258
- }
259
- }