Forest Logo
search
package_2

jecs-assemblies

By @pepeeltoro41

Roblox

Mirrored

Jecs Assemblies

Utility for calculating cframe offset chains for Jecs.

Setup

  • Replace transform, relative, and pivot with your own components. This is optional, and components will be created if they don't exist when calling jecs_assemblies.world.

  • Call jecs_assemblies.world(world) before using it to set it up with your world.

  • Add jecs_assemblies.system() to your systems. Set the order right before your transform cframes apply.

local c = require(components)
local jecs_assemblies = require(jecs_assemblies)

jecs_assemblies.transform = c.transform
jecs_assemblies.world(world)

return {
    system = function()
        jecs_assemblies.system()
    end
}

Usage

  • Use jecs_assemblies.pivot as a pair to reference a parent entity.
  • Use jecs_assemblies.relative to set a relative CFrame to the parent.
  • Transforms will be applied to jecs_assemblies.transform. The very first parent will use the value of jecs_assemblies.transform.
  • You can chain multiple pivots to get a final transform.
local c = require(components)
local ja = require(jecs_assemblies)

local character = world:entity()
local camera = world:entity()

world:set(character, c.transform, cf)

world:add(camera, pair(ja.pivot, character))
world:set(camera, c.relative, rel)

-- camera transform = character transform * camera rel

Swapping pivots

  • use jecs_assemblies.swap_pivot to swap the pivot of an entity. This will change your pivot while keeping the world space transform by calculating the relative cframe from the current entity transform and the new pivot transform. This function will also remove any previous pivots.

Package Details

Install command (Click to copy)


Version

1.0.2

License

MIT

check_circle

Safe for commercial use

infoLicense identified from the packaged LICENSE file; the manifest declared none.

Automated license review — not legal advice.