constructor(rad?: number)
View sourceCreates an angle in radians.
Class
ExtendsAngle
Represents an entity’s accumulated angular input in 2D as an ECS component.
Its scalar value follows Angle and is expressed in radians. A new
component starts at 0 radians. Use it with Rotation2D.
import { Query, World } from '@wimaengine/ecs'
import { Torque2D } from '@wimaengine/movable'
const world = new World()
world.spawn([new Torque2D()])
new Query(world, [Torque2D]).each(([torque]) => {
// Accumulate a one-degree angular input.
torque.value += Math.PI / 180
})copy(source: Torque2D, target?: Torque2D): Torque2DCopies the scalar value from one Torque2D into another.
clone(target: Torque2D): Torque2DCreates a new Torque2D with the same scalar value as the source.
default(): Torque2Dserialize(value: Torque2D): numberSerializes a Torque2D to its scalar radian value.
deserialize(value: number, out?: Torque2D): Torque2DCreates or updates a Torque2D from a serialized scalar radian value.