diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index ff98dc6..7f14797 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -2166,9 +2166,14 @@ ${SNIPPET_BROADCAST} local won = false --- При старте — облёт уровня камерой по точкам --- (точки x,y,z через запятую; segDuration — длительность одного отрезка) -__rbxl_camera_cutscene("0,18,-10, 12,12,8, -12,12,18, 0,10,28", 1.8) +-- При старте — облёт уровня камерой по точкам. +-- 1-й arg — путь камеры (4 точки x,y,z), +-- 2-й — длительность одного отрезка, +-- 3-й — куда камера смотрит в каждой точке (тоже 4 точки). +__rbxl_camera_cutscene( + "0,18,-10, 12,12,8, -12,12,18, 0,10,28", 1.8, + "0,2,8, 0,2,14, 0,2,20, 0,2,27" +) local winSound = Instance.new("Sound", workspace) winSound.SoundId = "win"; winSound.Volume = 1 diff --git a/src/editor/engine/lua/RobloxShim.js b/src/editor/engine/lua/RobloxShim.js index 00af0d4..5480426 100644 --- a/src/editor/engine/lua/RobloxShim.js +++ b/src/editor/engine/lua/RobloxShim.js @@ -1966,16 +1966,20 @@ export function registerRobloxShim(lua, opts) { send('player.heal', { amount: Number(amount) || 0 }); }); // Камера-облёт — паритет с JS game.camera.cutscene(points, opts). - // pointsFlat: x1,y1,z1,x2,y2,z2,... — потому что массив объектов - // в wasmoon через C-boundary неудобен. - global.set('__rbxl_camera_cutscene', (pointsFlat, segDuration) => { - const arr = String(pointsFlat || '').split(',').map((s) => Number(s) || 0); - const points = []; - for (let i = 0; i + 2 < arr.length; i += 3) { - points.push({ x: arr[i], y: arr[i + 1], z: arr[i + 2] }); - } + // pointsFlat/lookAtFlat: x1,y1,z1,x2,y2,z2,... — потому что массив + // объектов в wasmoon через C-boundary неудобен. + global.set('__rbxl_camera_cutscene', (pointsFlat, segDuration, lookAtFlat) => { + const parse = (s) => { + const out = []; + const arr = String(s || '').split(',').map((v) => Number(v) || 0); + for (let i = 0; i + 2 < arr.length; i += 3) { + out.push({ x: arr[i], y: arr[i + 1], z: arr[i + 2] }); + } + return out; + }; send('camera.cutscene', { - points, + points: parse(pointsFlat), + lookAt: lookAtFlat ? parse(lookAtFlat) : [], segDuration: Number(segDuration) || 1.5, }); });