spoint 0.1.55 → 0.1.57
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/SKILL.md +1 -1
- package/client/camera.js +16 -0
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: spoint
|
|
3
|
-
description: Build multiplayer physics games with the Spawnpoint engine. Use when asked to: create a game, add physics objects, spawn entities, build an arena, handle player interaction, add weapons
|
|
3
|
+
description: "Build multiplayer physics games with the Spawnpoint engine. Use when asked to: create a game, add physics objects, spawn entities, build an arena, handle player interaction, add weapons, respawn, scoring, create moving platforms, manage world config, load 3D models, add HUD/UI, work with the EventBus, or develop any app inside an apps/ directory."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Spawnpoint App Development Reference
|
package/client/camera.js
CHANGED
|
@@ -152,6 +152,7 @@ export function createCameraController(camera, scene) {
|
|
|
152
152
|
}
|
|
153
153
|
if (headBone && !headBoneHidden) { headBone.scale.set(0, 0, 0); headBoneHidden = true }
|
|
154
154
|
const wallDist = 0.35
|
|
155
|
+
const fwdWallDist = 0.25
|
|
155
156
|
fpsRayTimer += frameDt
|
|
156
157
|
if (fpsRayTimer >= 0.05 && envMeshes.length) {
|
|
157
158
|
fpsRayTimer = 0
|
|
@@ -171,6 +172,21 @@ export function createCameraController(camera, scene) {
|
|
|
171
172
|
}
|
|
172
173
|
break
|
|
173
174
|
}
|
|
175
|
+
_fpsRayDir.set(fwdX, fwdY, fwdZ)
|
|
176
|
+
camRaycaster.set(camera.position, _fpsRayDir)
|
|
177
|
+
camRaycaster.far = fwdWallDist
|
|
178
|
+
camRaycaster.near = 0
|
|
179
|
+
const fwdHits = camRaycaster.intersectObjects(envMeshes, true)
|
|
180
|
+
for (const hit of fwdHits) {
|
|
181
|
+
if (localMesh && isDescendant(hit.object, localMesh)) continue
|
|
182
|
+
const push = fwdWallDist - hit.distance
|
|
183
|
+
if (push > 0) {
|
|
184
|
+
camera.position.x -= fwdX * push
|
|
185
|
+
camera.position.y -= fwdY * push
|
|
186
|
+
camera.position.z -= fwdZ * push
|
|
187
|
+
}
|
|
188
|
+
break
|
|
189
|
+
}
|
|
174
190
|
}
|
|
175
191
|
camera.lookAt(camera.position.x + fwdX, camera.position.y + fwdY, camera.position.z + fwdZ)
|
|
176
192
|
} else {
|