Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit8d45df8664

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?: the Force component 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, in space.
  • torque: { x, y, z }?: a torque, in newton-metres, in space, beside the one the force's offset from the centre of mass makes.
  • space: string?: the ForceSpace variant name force and torque are stated in, "Local" (the entity's own frame, turning with the body) or "World".
  • point: { x, y, z }?: where the force acts, in pointSpace.
  • 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, wherever point stands.
  • 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 })