hytopia 0.1.51 → 0.1.52

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.
@@ -128,7 +128,7 @@ _(Optional)_ A callback function for when the controller ticks.
128
128
 
129
129
  </td><td>
130
130
 
131
- _(Optional)_ A callback function for when the controller ticks player movement. This is called every tick by a PlayerEntity with a character controller.
131
+ _(Optional)_ A callback function for when the controller ticks player movement.
132
132
 
133
133
 
134
134
  </td></tr>
@@ -190,7 +190,7 @@ Override this method to handle entity movements based on your character controll
190
190
 
191
191
  </td><td>
192
192
 
193
- Override this method to handle entity movements based on player input for your character controller.
193
+ Override this method to handle entity movements based on player input for your character controller. This is called every tick by a PlayerEntity with a character controller.
194
194
 
195
195
 
196
196
  </td></tr>
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## BaseCharacterController.onTickWithPlayerInput property
6
6
 
7
- A callback function for when the controller ticks player movement. This is called every tick by a PlayerEntity with a character controller.
7
+ A callback function for when the controller ticks player movement.
8
8
 
9
9
  **Signature:**
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## BaseCharacterController.tickWithPlayerInput() method
6
6
 
7
- Override this method to handle entity movements based on player input for your character controller.
7
+ Override this method to handle entity movements based on player input for your character controller. This is called every tick by a PlayerEntity with a character controller.
8
8
 
9
9
  **Signature:**
10
10
 
@@ -168,7 +168,7 @@ Description
168
168
  </th></tr></thead>
169
169
  <tbody><tr><td>
170
170
 
171
- [castRay(origin, direction, length, options)](./server.simulation.castray.md)
171
+ [enableDebugRaycasting(enabled)](./server.simulation.enabledebugraycasting.md)
172
172
 
173
173
 
174
174
  </td><td>
@@ -176,13 +176,13 @@ Description
176
176
 
177
177
  </td><td>
178
178
 
179
- Casts a ray through the simulation.
179
+ Enables or disables debug raycasting for the simulation. This will render lines for the raycast that disappear after a few seconds.
180
180
 
181
181
 
182
182
  </td></tr>
183
183
  <tr><td>
184
184
 
185
- [enableDebugRaycasting(enabled)](./server.simulation.enabledebugraycasting.md)
185
+ [enableDebugRendering(enabled)](./server.simulation.enabledebugrendering.md)
186
186
 
187
187
 
188
188
  </td><td>
@@ -190,13 +190,13 @@ Casts a ray through the simulation.
190
190
 
191
191
  </td><td>
192
192
 
193
- Enables or disables debug raycasting for the simulation. This will render lines for the raycast that disappear after a few seconds.
193
+ Enables or disables debug rendering for the simulation. When enabled, all colliders and rigid body outlines will be rendered in the world. Do not enable this in production. In large worlds enabling this can cause noticable lag and RTT spikes.
194
194
 
195
195
 
196
196
  </td></tr>
197
197
  <tr><td>
198
198
 
199
- [enableDebugRendering(enabled)](./server.simulation.enabledebugrendering.md)
199
+ [getContactManifolds(colliderHandleA, colliderHandleB)](./server.simulation.getcontactmanifolds.md)
200
200
 
201
201
 
202
202
  </td><td>
@@ -204,13 +204,13 @@ Enables or disables debug raycasting for the simulation. This will render lines
204
204
 
205
205
  </td><td>
206
206
 
207
- Enables or disables debug rendering for the simulation. When enabled, all colliders and rigid body outlines will be rendered in the world. Do not enable this in production. In large worlds enabling this can cause noticable lag and RTT spikes.
207
+ Gets the contact manifolds for a pair of colliders.
208
208
 
209
209
 
210
210
  </td></tr>
211
211
  <tr><td>
212
212
 
213
- [getContactManifolds(colliderHandleA, colliderHandleB)](./server.simulation.getcontactmanifolds.md)
213
+ [raycast(origin, direction, length, options)](./server.simulation.raycast.md)
214
214
 
215
215
 
216
216
  </td><td>
@@ -218,7 +218,7 @@ Enables or disables debug rendering for the simulation. When enabled, all collid
218
218
 
219
219
  </td><td>
220
220
 
221
- Gets the contact manifolds for a pair of colliders.
221
+ Casts a ray through the simulation.
222
222
 
223
223
 
224
224
  </td></tr>
@@ -1,15 +1,15 @@
1
1
  <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
2
 
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [Simulation](./server.simulation.md) &gt; [castRay](./server.simulation.castray.md)
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [Simulation](./server.simulation.md) &gt; [raycast](./server.simulation.raycast.md)
4
4
 
5
- ## Simulation.castRay() method
5
+ ## Simulation.raycast() method
6
6
 
7
7
  Casts a ray through the simulation.
8
8
 
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- castRay(origin: RAPIER.Vector3, direction: RAPIER.Vector3, length: number, options?: RayCastOptions): Block | Entity | null;
12
+ raycast(origin: RAPIER.Vector3, direction: RAPIER.Vector3, length: number, options?: RaycastOptions): RaycastHit | null;
13
13
  ```
14
14
 
15
15
  ## Parameters
@@ -85,7 +85,7 @@ options
85
85
 
86
86
  </td><td>
87
87
 
88
- RayCastOptions
88
+ RaycastOptions
89
89
 
90
90
 
91
91
  </td><td>
@@ -97,7 +97,11 @@ _(Optional)_ The options for the raycast.
97
97
  </tbody></table>
98
98
  **Returns:**
99
99
 
100
- [Block](./server.block.md) \| [Entity](./server.entity.md) \| null
100
+ RaycastHit \| null
101
101
 
102
- The first block or entity hit by the ray, or null if no hit.
102
+ A RaycastHit object containing the first block or entity hit by the ray, or null if no hit.
103
+
104
+ ## Remarks
105
+
106
+ The cast ray will stop at the the first block or entity hit within the length of the ray.
103
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.1.51",
3
+ "version": "0.1.52",
4
4
  "description": "The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.api.json CHANGED
@@ -2786,7 +2786,7 @@
2786
2786
  {
2787
2787
  "kind": "Property",
2788
2788
  "canonicalReference": "server!BaseCharacterController#onTickWithPlayerInput:member",
2789
- "docComment": "/**\n * A callback function for when the controller ticks player movement. This is called every tick by a PlayerEntity with a character controller.\n *\n * @param input - The current input state of the player.\n *\n * @param cameraOrientation - The current camera orientation state of the player.\n *\n * @param deltaTimeMs - The delta time in milliseconds since the last tick.\n */\n",
2789
+ "docComment": "/**\n * A callback function for when the controller ticks player movement.\n *\n * @param input - The current input state of the player.\n *\n * @param cameraOrientation - The current camera orientation state of the player.\n *\n * @param deltaTimeMs - The delta time in milliseconds since the last tick.\n */\n",
2790
2790
  "excerptTokens": [
2791
2791
  {
2792
2792
  "kind": "Content",
@@ -2882,7 +2882,7 @@
2882
2882
  {
2883
2883
  "kind": "Method",
2884
2884
  "canonicalReference": "server!BaseCharacterController#tickWithPlayerInput:member(1)",
2885
- "docComment": "/**\n * Override this method to handle entity movements based on player input for your character controller.\n *\n * @param input - The current input state of the player.\n *\n * @param cameraOrientation - The current camera orientation state of the player.\n *\n * @param deltaTimeMs - The delta time in milliseconds since the last tick.\n */\n",
2885
+ "docComment": "/**\n * Override this method to handle entity movements based on player input for your character controller. This is called every tick by a PlayerEntity with a character controller.\n *\n * @param input - The current input state of the player.\n *\n * @param cameraOrientation - The current camera orientation state of the player.\n *\n * @param deltaTimeMs - The delta time in milliseconds since the last tick.\n */\n",
2886
2886
  "excerptTokens": [
2887
2887
  {
2888
2888
  "kind": "Content",
@@ -22685,119 +22685,6 @@
22685
22685
  "name": "Simulation",
22686
22686
  "preserveMemberOrder": false,
22687
22687
  "members": [
22688
- {
22689
- "kind": "Method",
22690
- "canonicalReference": "server!Simulation#castRay:member(1)",
22691
- "docComment": "/**\n * Casts a ray through the simulation.\n *\n * @param origin - The origin of the ray.\n *\n * @param direction - The direction of the ray.\n *\n * @param length - The length of the ray.\n *\n * @param options - The options for the raycast.\n *\n * @returns The first block or entity hit by the ray, or null if no hit.\n */\n",
22692
- "excerptTokens": [
22693
- {
22694
- "kind": "Content",
22695
- "text": "castRay(origin: "
22696
- },
22697
- {
22698
- "kind": "Reference",
22699
- "text": "RAPIER.Vector3",
22700
- "canonicalReference": "@dimforge/rapier3d-compat!Vector3:class"
22701
- },
22702
- {
22703
- "kind": "Content",
22704
- "text": ", direction: "
22705
- },
22706
- {
22707
- "kind": "Reference",
22708
- "text": "RAPIER.Vector3",
22709
- "canonicalReference": "@dimforge/rapier3d-compat!Vector3:class"
22710
- },
22711
- {
22712
- "kind": "Content",
22713
- "text": ", length: "
22714
- },
22715
- {
22716
- "kind": "Content",
22717
- "text": "number"
22718
- },
22719
- {
22720
- "kind": "Content",
22721
- "text": ", options?: "
22722
- },
22723
- {
22724
- "kind": "Reference",
22725
- "text": "RayCastOptions",
22726
- "canonicalReference": "server!~RayCastOptions:type"
22727
- },
22728
- {
22729
- "kind": "Content",
22730
- "text": "): "
22731
- },
22732
- {
22733
- "kind": "Reference",
22734
- "text": "Block",
22735
- "canonicalReference": "server!Block:class"
22736
- },
22737
- {
22738
- "kind": "Content",
22739
- "text": " | "
22740
- },
22741
- {
22742
- "kind": "Reference",
22743
- "text": "Entity",
22744
- "canonicalReference": "server!Entity:class"
22745
- },
22746
- {
22747
- "kind": "Content",
22748
- "text": " | null"
22749
- },
22750
- {
22751
- "kind": "Content",
22752
- "text": ";"
22753
- }
22754
- ],
22755
- "isStatic": false,
22756
- "returnTypeTokenRange": {
22757
- "startIndex": 9,
22758
- "endIndex": 13
22759
- },
22760
- "releaseTag": "Public",
22761
- "isProtected": false,
22762
- "overloadIndex": 1,
22763
- "parameters": [
22764
- {
22765
- "parameterName": "origin",
22766
- "parameterTypeTokenRange": {
22767
- "startIndex": 1,
22768
- "endIndex": 2
22769
- },
22770
- "isOptional": false
22771
- },
22772
- {
22773
- "parameterName": "direction",
22774
- "parameterTypeTokenRange": {
22775
- "startIndex": 3,
22776
- "endIndex": 4
22777
- },
22778
- "isOptional": false
22779
- },
22780
- {
22781
- "parameterName": "length",
22782
- "parameterTypeTokenRange": {
22783
- "startIndex": 5,
22784
- "endIndex": 6
22785
- },
22786
- "isOptional": false
22787
- },
22788
- {
22789
- "parameterName": "options",
22790
- "parameterTypeTokenRange": {
22791
- "startIndex": 7,
22792
- "endIndex": 8
22793
- },
22794
- "isOptional": true
22795
- }
22796
- ],
22797
- "isOptional": false,
22798
- "isAbstract": false,
22799
- "name": "castRay"
22800
- },
22801
22688
  {
22802
22689
  "kind": "Method",
22803
22690
  "canonicalReference": "server!Simulation#enableDebugRaycasting:member(1)",
@@ -23056,6 +22943,110 @@
23056
22943
  "isProtected": false,
23057
22944
  "isAbstract": false
23058
22945
  },
22946
+ {
22947
+ "kind": "Method",
22948
+ "canonicalReference": "server!Simulation#raycast:member(1)",
22949
+ "docComment": "/**\n * Casts a ray through the simulation.\n *\n * @remarks\n *\n * The cast ray will stop at the the first block or entity hit within the length of the ray.\n *\n * @param origin - The origin of the ray.\n *\n * @param direction - The direction of the ray.\n *\n * @param length - The length of the ray.\n *\n * @param options - The options for the raycast.\n *\n * @returns A RaycastHit object containing the first block or entity hit by the ray, or null if no hit.\n */\n",
22950
+ "excerptTokens": [
22951
+ {
22952
+ "kind": "Content",
22953
+ "text": "raycast(origin: "
22954
+ },
22955
+ {
22956
+ "kind": "Reference",
22957
+ "text": "RAPIER.Vector3",
22958
+ "canonicalReference": "@dimforge/rapier3d-compat!Vector3:class"
22959
+ },
22960
+ {
22961
+ "kind": "Content",
22962
+ "text": ", direction: "
22963
+ },
22964
+ {
22965
+ "kind": "Reference",
22966
+ "text": "RAPIER.Vector3",
22967
+ "canonicalReference": "@dimforge/rapier3d-compat!Vector3:class"
22968
+ },
22969
+ {
22970
+ "kind": "Content",
22971
+ "text": ", length: "
22972
+ },
22973
+ {
22974
+ "kind": "Content",
22975
+ "text": "number"
22976
+ },
22977
+ {
22978
+ "kind": "Content",
22979
+ "text": ", options?: "
22980
+ },
22981
+ {
22982
+ "kind": "Reference",
22983
+ "text": "RaycastOptions",
22984
+ "canonicalReference": "server!~RaycastOptions:type"
22985
+ },
22986
+ {
22987
+ "kind": "Content",
22988
+ "text": "): "
22989
+ },
22990
+ {
22991
+ "kind": "Reference",
22992
+ "text": "RaycastHit",
22993
+ "canonicalReference": "server!~RaycastHit:type"
22994
+ },
22995
+ {
22996
+ "kind": "Content",
22997
+ "text": " | null"
22998
+ },
22999
+ {
23000
+ "kind": "Content",
23001
+ "text": ";"
23002
+ }
23003
+ ],
23004
+ "isStatic": false,
23005
+ "returnTypeTokenRange": {
23006
+ "startIndex": 9,
23007
+ "endIndex": 11
23008
+ },
23009
+ "releaseTag": "Public",
23010
+ "isProtected": false,
23011
+ "overloadIndex": 1,
23012
+ "parameters": [
23013
+ {
23014
+ "parameterName": "origin",
23015
+ "parameterTypeTokenRange": {
23016
+ "startIndex": 1,
23017
+ "endIndex": 2
23018
+ },
23019
+ "isOptional": false
23020
+ },
23021
+ {
23022
+ "parameterName": "direction",
23023
+ "parameterTypeTokenRange": {
23024
+ "startIndex": 3,
23025
+ "endIndex": 4
23026
+ },
23027
+ "isOptional": false
23028
+ },
23029
+ {
23030
+ "parameterName": "length",
23031
+ "parameterTypeTokenRange": {
23032
+ "startIndex": 5,
23033
+ "endIndex": 6
23034
+ },
23035
+ "isOptional": false
23036
+ },
23037
+ {
23038
+ "parameterName": "options",
23039
+ "parameterTypeTokenRange": {
23040
+ "startIndex": 7,
23041
+ "endIndex": 8
23042
+ },
23043
+ "isOptional": true
23044
+ }
23045
+ ],
23046
+ "isOptional": false,
23047
+ "isAbstract": false,
23048
+ "name": "raycast"
23049
+ },
23059
23050
  {
23060
23051
  "kind": "Method",
23061
23052
  "canonicalReference": "server!Simulation#setGravity:member(1)",
package/server.d.ts CHANGED
@@ -296,8 +296,7 @@ export declare abstract class BaseCharacterController {
296
296
  onTick?: (deltaTimeMs: number) => void;
297
297
  /**
298
298
  * A callback function for when the controller ticks
299
- * player movement. This is called every tick by a
300
- * PlayerEntity with a character controller.
299
+ * player movement.
301
300
  * @param input - The current input state of the player.
302
301
  * @param cameraOrientation - The current camera orientation state of the player.
303
302
  * @param deltaTimeMs - The delta time in milliseconds since the last tick.
@@ -317,6 +316,8 @@ export declare abstract class BaseCharacterController {
317
316
  /**
318
317
  * Override this method to handle entity movements
319
318
  * based on player input for your character controller.
319
+ * This is called every tick by a PlayerEntity with a
320
+ * character controller.
320
321
  * @param input - The current input state of the player.
321
322
  * @param cameraOrientation - The current camera orientation state of the player.
322
323
  * @param deltaTimeMs - The delta time in milliseconds since the last tick.
@@ -2432,8 +2433,17 @@ export declare interface QuaternionLike {
2432
2433
  /** A raw set of collision groups represented as a 32-bit number. @public */
2433
2434
  export declare type RawCollisionGroups = RAPIER.InteractionGroups;
2434
2435
 
2436
+ declare type RaycastHit = {
2437
+ /** The block or entity the raycast hit. */
2438
+ hitObject: Block | Entity;
2439
+ /** The point in global coordinate space the raycast hit the object. */
2440
+ hitPoint: Vector3Like;
2441
+ /** The distance from origin where the raycast hit. */
2442
+ hitDistance: number;
2443
+ };
2444
+
2435
2445
  /** Options for raycasting. @public */
2436
- declare type RayCastOptions = {
2446
+ declare type RaycastOptions = {
2437
2447
  /** Whether to ignore sensor colliders. */
2438
2448
  ignoresSensors?: boolean;
2439
2449
  /** The query filter flags. */
@@ -3003,13 +3013,18 @@ export declare class Simulation {
3003
3013
  get world(): World;
3004
3014
  /**
3005
3015
  * Casts a ray through the simulation.
3016
+ *
3017
+ * @remarks
3018
+ * The cast ray will stop at the the first block or
3019
+ * entity hit within the length of the ray.
3020
+ *
3006
3021
  * @param origin - The origin of the ray.
3007
3022
  * @param direction - The direction of the ray.
3008
3023
  * @param length - The length of the ray.
3009
3024
  * @param options - The options for the raycast.
3010
- * @returns The first block or entity hit by the ray, or null if no hit.
3025
+ * @returns A RaycastHit object containing the first block or entity hit by the ray, or null if no hit.
3011
3026
  */
3012
- castRay(origin: RAPIER.Vector3, direction: RAPIER.Vector3, length: number, options?: RayCastOptions): Block | Entity | null;
3027
+ raycast(origin: RAPIER.Vector3, direction: RAPIER.Vector3, length: number, options?: RaycastOptions): RaycastHit | null;
3013
3028
 
3014
3029
 
3015
3030
  /**