spoint 0.1.23 → 0.1.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoint",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "Physics and netcode SDK for multiplayer game servers",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -29,12 +29,10 @@ function encodeEntity(e) {
29
29
  }
30
30
 
31
31
  function entityKey(encoded) {
32
- let k = ''
33
- for (let i = 1; i < encoded.length; i++) {
34
- const v = encoded[i]
35
- k += v === null ? 'N' : typeof v === 'object' ? JSON.stringify(v) : v
36
- k += '|'
37
- }
32
+ let k = encoded[1]
33
+ for (let i = 2; i < 10; i++) k += '|' + encoded[i]
34
+ k += '|' + encoded[9]
35
+ if (encoded[10] !== null && encoded[10] !== undefined) k += '|' + JSON.stringify(encoded[10])
38
36
  return k
39
37
  }
40
38
 
@@ -11,6 +11,7 @@ export class PhysicsWorld {
11
11
  this.bodies = new Map(); this.bodyMeta = new Map()
12
12
  this._objFilter = null; this._ovbp = null
13
13
  this._charShapes = new Map()
14
+ this._tmpVec3 = null; this._tmpRVec3 = null
14
15
  }
15
16
  async init() {
16
17
  const J = await getJolt()
@@ -27,6 +28,7 @@ export class PhysicsWorld {
27
28
  this._objFilter = objFilter; this._ovbp = ovbp
28
29
  this.jolt = new J.JoltInterface(settings); J.destroy(settings)
29
30
  this.physicsSystem = this.jolt.GetPhysicsSystem(); this.bodyInterface = this.physicsSystem.GetBodyInterface()
31
+ this._tmpVec3 = new J.Vec3(0, 0, 0); this._tmpRVec3 = new J.RVec3(0, 0, 0)
30
32
  const [gx, gy, gz] = this.gravity
31
33
  this.physicsSystem.SetGravity(new J.Vec3(gx, gy, gz))
32
34
  return this