Builtin Library
README.md
ecs.Force
Spec for ecs.Force, which maps to the native Force: a force and a torque a rigid body carries from step to step, applied by every physics step until it changes or goes. The Force component drives it; this is the typed value the generic ecs verbs build and read.
Fields
name: string?: theForcecomponent instance's name on its entity,""for the unnamed one. A named one sits on an internal entity under that entity, at its origin, and reads back with that entity as its source.force: { x, y, z }?: the force, in newtons, inspace.torque: { x, y, z }?: a torque, in newton-metres, inspace, beside the one the force's offset from the centre of mass makes.space: string?: the ForceSpace variant nameforceandtorqueare stated in,"Local"(the entity's own frame, turning with the body) or"World".point: { x, y, z }?: where the force acts, inpointSpace.pointSpace: string?:"Local"(the entity's own space, its scale included, moving with the body) or"World".throughCenterOfMass: boolean?: the force acts through the body's centre of mass, making no torque, whereverpointstands.scale: number?: the factor on the force and the torque.scaleValue: string?: a named value whose number also multiplies the force and the torque, read from the entity or its nearest ancestor holding it.enabled: boolean?: whether the force acts.
Usage
ecs.insertSync(id, ecs.Force{ force = { x = 0, y = 98.1, z = 0 }, space = "World" })
ecs.set(id, ecs.Force{ scale = 0.5 })