spoint 0.1.74 → 0.1.76

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.
@@ -25,7 +25,12 @@ export default {
25
25
  server: {
26
26
  setup(ctx) {
27
27
  ctx.physics.setStatic(true)
28
- ctx.physics.addTrimeshCollider()
28
+ try {
29
+ ctx.physics.addTrimeshCollider()
30
+ } catch (e) {
31
+ ctx.debug.log(`[Environment] Trimesh collider failed (likely Draco compression), using fallback box collider: ${e.message}`)
32
+ ctx.physics.addBoxCollider([50, 0.5, 50])
33
+ }
29
34
 
30
35
  ctx.state.smartObjects = new Map()
31
36
  ctx.state.editorMode = false
Binary file
Binary file
package/client/app.js CHANGED
@@ -740,30 +740,42 @@ async function createPlayerVRM(id) {
740
740
  try {
741
741
  const gltf = await gltfLoader.parseAsync(vrmBuffer.buffer.slice(0), '')
742
742
  const vrm = gltf.userData.vrm
743
- if (!vrm) { console.error('[vrm]', id, 'VRMLoaderPlugin did not produce vrm - file may not be VRM format'); return group }
744
- VRMUtils.removeUnnecessaryVertices(vrm.scene)
745
- VRMUtils.combineSkeletons(vrm.scene)
746
- const vrmVersion = detectVrmVersion(vrmBuffer)
747
- vrm.scene.rotation.y = Math.PI
748
- vrm.scene.traverse(c => { if (c.isMesh) { c.castShadow = true; c.receiveShadow = true } })
749
- const pc = worldConfig.player || {}
750
- const modelScale = pc.modelScale || 1.323
751
- const feetOffsetRatio = pc.feetOffset || 0.212
752
- vrm.scene.scale.multiplyScalar(modelScale)
753
- vrm.scene.position.y = -feetOffsetRatio * modelScale
754
- group.userData.feetOffset = 1.3
755
- group.add(vrm.scene)
756
- playerVrms.set(id, vrm)
757
- initVRMFeatures(id, vrm)
758
- if (animAssets) {
759
- const animator = createPlayerAnimator(vrm, animAssets, vrmVersion, worldConfig.animation || {})
760
- playerAnimators.set(id, animator)
761
- }
762
- if (id === client.playerId && vrm.humanoid) {
763
- const head = vrm.humanoid.getRawBoneNode('head')
764
- if (head) cam.setCameraBone(head)
765
- if (head) cam.setHeadBone(head)
766
- if (cam.getMode() === 'fps' && head) head.scale.set(0, 0, 0)
743
+ if (vrm) {
744
+ VRMUtils.removeUnnecessaryVertices(vrm.scene)
745
+ VRMUtils.combineSkeletons(vrm.scene)
746
+ const vrmVersion = detectVrmVersion(vrmBuffer)
747
+ vrm.scene.rotation.y = Math.PI
748
+ vrm.scene.traverse(c => { if (c.isMesh) { c.castShadow = true; c.receiveShadow = true } })
749
+ const pc = worldConfig.player || {}
750
+ const modelScale = pc.modelScale || 1.323
751
+ const feetOffsetRatio = pc.feetOffset || 0.212
752
+ vrm.scene.scale.multiplyScalar(modelScale)
753
+ vrm.scene.position.y = -feetOffsetRatio * modelScale
754
+ group.userData.feetOffset = 1.3
755
+ group.add(vrm.scene)
756
+ playerVrms.set(id, vrm)
757
+ initVRMFeatures(id, vrm)
758
+ if (animAssets) {
759
+ const animator = createPlayerAnimator(vrm, animAssets, vrmVersion, worldConfig.animation || {})
760
+ playerAnimators.set(id, animator)
761
+ }
762
+ if (id === client.playerId && vrm.humanoid) {
763
+ const head = vrm.humanoid.getRawBoneNode('head')
764
+ if (head) cam.setCameraBone(head)
765
+ if (head) cam.setHeadBone(head)
766
+ if (cam.getMode() === 'fps' && head) head.scale.set(0, 0, 0)
767
+ }
768
+ } else {
769
+ const scene = gltf.scene
770
+ scene.traverse(c => { if (c.isMesh) { c.castShadow = true; c.receiveShadow = true } })
771
+ const pc = worldConfig.player || {}
772
+ const modelScale = pc.modelScale || 1.323
773
+ const feetOffsetRatio = pc.feetOffset || 0.212
774
+ scene.scale.multiplyScalar(modelScale)
775
+ scene.position.y = -feetOffsetRatio * modelScale
776
+ group.userData.feetOffset = 1.3
777
+ group.add(scene)
778
+ console.log('[player]', id, 'loaded as plain GLB (not VRM)')
767
779
  }
768
780
  if (!_vrmWarmupDone) {
769
781
  _vrmWarmupDone = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoint",
3
- "version": "0.1.74",
3
+ "version": "0.1.76",
4
4
  "description": "Physics and netcode SDK for multiplayer game servers",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -230,8 +230,8 @@ export class PhysicsWorld {
230
230
  const dir = len > 0 ? [direction[0] / len, direction[1] / len, direction[2] / len] : direction
231
231
  const ray = new J.RRayCast(new J.RVec3(origin[0], origin[1], origin[2]), new J.Vec3(dir[0] * maxDistance, dir[1] * maxDistance, dir[2] * maxDistance))
232
232
  const rs = new J.RayCastSettings(), col = new J.CastRayClosestHitCollisionCollector()
233
- const bp = new J.DefaultBroadPhaseLayerFilter(this._ovbp, LAYER_DYNAMIC)
234
- const ol = new J.DefaultObjectLayerFilter(this._objFilter, LAYER_DYNAMIC)
233
+ const bp = new J.DefaultBroadPhaseLayerFilter(this._ovbp)
234
+ const ol = new J.DefaultObjectLayerFilter(this._objFilter)
235
235
  const eb = excludeBodyId != null ? this._getBody(excludeBodyId) : null
236
236
  const bf = eb ? new J.IgnoreSingleBodyFilter(eb.GetID()) : new J.BodyFilter()
237
237
  const sf = new J.ShapeFilter()