Ashlar checks / tooling (push) Successful in 5s
- Shoulder view, auto shoulder switch, standing preview, deferred preview rotation, move 360, smooth view change and [Game] smooth movement are on by default. - Collision ease-out: the camera still snaps in on collision but eases back out (0.15 s half-life, 60 u/s minimum speed). - Aim mode: with a ranged weapon or a spell readied in third person the view stays over the shoulder, moves closer and narrows the FOV. Camera interface v2 adds getAimWeight and enable/disable functions. - Pure math in camera/ease.lua with unit tests; SCENARIO=camera with PASS/FAIL checks; docs in docs/ashlar/CAMERA.md. - ashlar-run.sh deletes stored Lua settings before each run so changed defaults are tested. Closes #29 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
2.0 KiB
Lua
46 lines
2.0 KiB
Lua
-- Ashlar headless camera scenario (CC0). Places a wall (meshes/ashlar_ledge.dae, a plain 160 unit box, scaled 3x)
|
|
-- behind the camera and removes it again, and gives the player a test bow for the aim phase.
|
|
local world = require('openmw.world')
|
|
local types = require('openmw.types')
|
|
local util = require('openmw.util')
|
|
|
|
local wall
|
|
local SCALE = 3
|
|
local HALF = 80 * SCALE
|
|
|
|
local function log(...)
|
|
print('ASHLAR_CAMERA', ...)
|
|
end
|
|
|
|
return {
|
|
eventHandlers = {
|
|
AshlarCameraWall = function(data)
|
|
if not wall then
|
|
local rec = world.createRecord(types.Static.createRecordDraft { model = 'meshes/ashlar_ledge.dae' })
|
|
wall = world.createObject(rec.id)
|
|
wall:setScale(SCALE)
|
|
end
|
|
local back = util.vector3(-math.sin(data.yaw), -math.cos(data.yaw), 0)
|
|
if data.on then
|
|
-- Near face of the wall `distance` units behind the player.
|
|
wall:teleport(data.player.cell, data.player.position + back * (data.distance + HALF))
|
|
log(string.format('wall %.0f units behind the player', data.distance))
|
|
else
|
|
wall:teleport(data.player.cell, data.player.position - back * 5000 - util.vector3(0, 0, 5000))
|
|
log('wall removed')
|
|
end
|
|
end,
|
|
AshlarCameraBow = function(data)
|
|
local rec = world.createRecord(types.Weapon.createRecordDraft {
|
|
name = 'Test Bow', type = types.Weapon.TYPE.MarksmanBow, weight = 3, value = 1, health = 5000,
|
|
speed = 1, reach = 1, enchantCapacity = 0, chopMinDamage = 2, chopMaxDamage = 4, slashMinDamage = 2,
|
|
slashMaxDamage = 4, thrustMinDamage = 2, thrustMaxDamage = 4, model = 'meshes/marker_error.dae',
|
|
icon = '' })
|
|
local bow = world.createObject(rec.id)
|
|
bow:moveInto(types.Actor.inventory(data.player))
|
|
data.player:sendEvent('AshlarCameraBowReady', { bow = bow })
|
|
log('bow given')
|
|
end,
|
|
},
|
|
}
|