Log inGet started
Package

EcsPhysicsLatch.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

ecs.PhysicsLatch

Spec for ecs.PhysicsLatch, which maps to the native PhysicsLatch: a latch point on a rigid body, matched against the other latch points after every physics step. The Latch component drives it and joins a latched pair with a joint; this is the typed value the generic ecs verbs build and read.

Fields

  • tag: string?: what the point is ("hitch", "coupler", "dock").
  • accepts: { string }?: the tags of the points it latches to; empty latches to points of its own tag. Two points latch only when each accepts the other's tag.
  • offset: { x, y, z }?: where the point stands, in the entity's frame. The point's frame is turned as the entity is.
  • radius: number?: metres. Two points latch within the larger of their two radii.
  • maxAngle: number?: degrees. Two points latch while the turn taking one point's frame onto the other's is within the smaller of their two; 180 latches turned any way.
  • maxSpeed: number?: metres per second. Two points latch while they move relative to each other no faster than the smaller of their positive speeds; 0 latches at any speed.
  • armed: boolean?: whether the point latches.
  • partner: string?: written by the simulation, the entity id of the point this one is latched to; empty while free.
  • waitingClear: boolean?: a released point latches again once no compatible point stands within reach of it.
  • problem: string?: written by the simulation, why the point cannot latch (no body at or above it, or a soft body), naming its entity.

Usage

ecs.insertSync(id, ecs.PhysicsLatch{ tag = "coupler", radius = 0.2, offset = { x = 0, y = 0, z = 2 } })
ecs.set(id, ecs.PhysicsLatch{ armed = false })