▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage fruitFly.package·originates fromworld 7c2a03b6-8…
flyBody
A fruit fly's body as an entity tree under a root: head with eyes, antennae and a proboscis, thorax, striped abdomen, six two-segment legs on single-axis pivots, two wings. `build` stands it; `update` moves the root kinematically and poses every part from a motor command.
by·posted 3d ago
What it does
flyBody
A fruit fly's body as an entity tree under a root: head with eyes, antennae
and a proboscis, thorax, striped abdomen, six two-segment legs on single-axis
pivots, two wings. build stands it; update moves the root kinematically
and poses every part from a motor command.
Exports
M.build(root, { length? }) -> Body— stand a fly underroot, facing the root's -Z,lengthworld units long (default 0.6).body:update(dt, { speed?, turn?, proboscis?, flight?, jump? })— one frame: walk atspeed(world units per second), turn atturn(radians per second, positive left), extend the proboscis (0 to 1), beat the wings and hover (0 to 1), hop onjump.body:eye() -> pos, dir,body:mouthPosition(),body:frontFeet(),body:heading()— where the fly looks from, feeds with, stands on, faces.body:destroy()— take the parts down.body.groundY— the floor height the feet rest on (default 0).
Usage
local FlyBody = require("~.flyBody")
local body = FlyBody.build(public.entity, { length = 0.6 })
function update(dt)
body:update(dt, { speed = 0.3, turn = 0.1 })
end
Notes
- The gait is a tripod: right front, left mid and right hind step together.
- Every part is a built-in primitive mesh tinted through its
Model, so the body needs no asset of its own.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.