constructor(value?: number)
View sourceCreates a 3D angular damping resource.
Class
Stores the scalar damping value for 3D angular motion.
Register Damping3DPlugin to add this resource to an app’s world.
Set value to control how strongly matching Rotation3D values are
damped. New instances default to 0, while the plugin-provided resource
starts at 0.01.
The damping multiplier is 1 - value: 0 leaves a matching rotation
unchanged, and 0.01 retains 99 percent of each rotation coordinate. The
resource serializes to an object with one numeric value field and can be
restored from that form. Serialized data must be a non-null object with a
numeric value; no damping range or finiteness check is required.
import { Angular3DDamping } from '@wimaengine/damping'
const damping = new Angular3DDamping(0.02)
const serial = Angular3DDamping.serialize(damping)
const restored = Angular3DDamping.deserialize(serial)
console.log(restored.value) // 0.02
// Damping3DPlugin installs its own resource with a default value of 0.01.Scalar damping value for matching 3D rotations.
The damping multiplier is 1 - value; 0 leaves each matching rotation
coordinate unchanged and 0.01 retains 99 percent of it.
default(): Angular3DDampingserialize(value: Angular3DDamping): Angular3DDampingSerialConverts a 3D angular damping resource to {value}.
deserialize(value: Angular3DDampingSerial, out?: Angular3DDamping): Angular3DDampingRestores a 3D angular damping resource from its serialized value.
The method copies value.value without applying a range or finiteness
check. When out is supplied, it updates and returns that instance;
otherwise it creates a new resource.
validateSerial(value: unknown): value is Angular3DDampingSerialChecks whether a value has the serialized 3D damping shape.
This guard requires a non-null object with a value property whose type
is number; it does not check whether the number is within a damping
range or finite.