SoftBody3D

View source

Marks an entity with the 3D soft-body component type.

SoftBody3D is an empty marker component with no instance fields. Use its presence to identify an entity as a 3D soft body; the marker carries no additional state of its own.

Examples

import { World } from '@wimaengine/ecs'
import { SoftBody3D } from '@wimaengine/narrowphase'

const world = new World()
const entity = world.spawn([new SoftBody3D()])
const marker = world.get(entity, SoftBody3D)
console.log(marker instanceof SoftBody3D) // true

Constructor


constructor()

Methods


staticcopy(source: SoftBody3D, target?: SoftBody3D): SoftBody3D

View source

Copies an empty marker into a target component.

SoftBody3D has no instance fields, so source is not read. When target is omitted, a new marker is created; otherwise the exact target is returned unchanged.

Parameters

NameDescriptionDefault
source

Marker to copy; it has no state to read.

—
target?

Marker to return unchanged.

...

Returns

The supplied target or a new empty marker.

staticclone(target: SoftBody3D): SoftBody3D

View source

Creates a new empty marker because there is no state to clone.

This delegates to SoftBody3D.copy without a target, so the supplied marker is not read and the result is always a new instance.

Parameters

NameDescriptionDefault
target

Marker to clone; it has no state to read.

—

Returns

A new empty marker.

staticserialize(_value: SoftBody3D): object

View source

Serializes the marker as an empty object.

There is no instance state to persist, so _value is not read.

Parameters

NameDescriptionDefault
_value

Marker to serialize; it has no state to read.

—

Returns

The marker’s empty serialized representation.

staticdeserialize(_value: unknown, out?: SoftBody3D): SoftBody3D

View source

Deserializes an empty marker without reading serialized data.

The input is not validated or read. This returns out when supplied, or creates and returns a new marker.

Parameters

NameDescriptionDefault
_value

Serialized marker data; it is ignored.

—
out?

Marker to return.

...

Returns

The supplied output marker or a new empty marker.