Lumiere is, as the tagline entails, a library made to help you program projectiles in parallel. It supplies you with a set of utilities and abstractions to make implementation as straightforward as possible.
Enough said, here’s a quick example:
-- actorTemplate/runtime.client.luau
-- imports omitted for clarity
local bullet = useBullet(actor)
local mutator = createMutator(bullet)
useLifecycleEvent(RunService.PostSimulation):withFixedFramerate(15):connectParallel(function(deltaTime)
mutator:incrementPosition(mutator.nextDirection * deltaTime)
local raycastResult = mutator:raycastForward()
if raycastResult ~= nil then
print(`bullet hit {raycastResult.Instance.Name}`)
end
mutator:flushMutations()
end)
-- test.client.luau
-- imports omitted for clarity
local source = createSource(script.bullets, script.actorTemplate)
local origin = Vector3.new(0, 15, 0)
local direction = Vector3.new(0, -15, 0)
source:makeBullet(origin, direction)
This will spawn a bullet at 0, 15, 0
going downwards at a constant speed of 15 studs per second, updating at 15 frames per second. It’ll log all parts it touches. You can learn more about Lumiere in the documentation.