eulerjs API / @eulerjs/core / MassProperties
MassProperties
Defined in: packages/core/src/MassProperties.ts:24
Mass, centre of mass and inertia tensor of a rigid body, all in the body's own frame. The inertia tensor is taken about the centre of mass.
Constructors
Constructor
new MassProperties(
mass,
centerOfMass,
inertia
): MassProperties;Defined in: packages/core/src/MassProperties.ts:29
Parameters
| Parameter | Type |
|---|---|
mass | number |
centerOfMass | Vector3 |
inertia | Matrix3 |
Returns
MassProperties
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
centerOfMass | readonly | Vector3 | packages/core/src/MassProperties.ts:26 |
inertia | readonly | Matrix3 | packages/core/src/MassProperties.ts:27 |
mass | readonly | number | packages/core/src/MassProperties.ts:25 |
Methods
box()
static box(
size,
mass,
center?
): MassProperties;Defined in: packages/core/src/MassProperties.ts:43
A solid box with the given edge lengths.
Parameters
| Parameter | Type |
|---|---|
size | Vector3 |
mass | number |
center? | Vector3 |
Returns
MassProperties
capsule()
static capsule(
radius,
length,
mass,
center?
): MassProperties;Defined in: packages/core/src/MassProperties.ts:63
A solid capsule along the y axis: a cylinder length long between the centres of the two hemispheres that cap it, both of radius.
Parameters
| Parameter | Type |
|---|---|
radius | number |
length | number |
mass | number |
center? | Vector3 |
Returns
MassProperties
combine()
combine(other): MassProperties;Defined in: packages/core/src/MassProperties.ts:165
Two rigidly joined parts as one body, e.g. a hull plus its ballast.
Parameters
| Parameter | Type |
|---|---|
other | MassProperties |
Returns
MassProperties
cone()
static cone(
radius,
height,
mass,
center?
): MassProperties;Defined in: packages/core/src/MassProperties.ts:88
A solid cone along the y axis, height tall with its tip up, placed as three.js's ConeGeometry is: centred halfway up, so its centre of mass is a quarter of the height below center.
Parameters
| Parameter | Type |
|---|---|
radius | number |
height | number |
mass | number |
center? | Vector3 |
Returns
MassProperties
cylinder()
static cylinder(
radius,
height,
mass,
center?
): MassProperties;Defined in: packages/core/src/MassProperties.ts:77
A solid cylinder along the y axis, height long, centred on center.
Parameters
| Parameter | Type |
|---|---|
radius | number |
height | number |
mass | number |
center? | Vector3 |
Returns
MassProperties
fromCells()
static fromCells(
cellCenters,
cellSize,
specification
): MassProperties;Defined in: packages/core/src/MassProperties.ts:137
Mass properties of a set of equal cubes (e.g. the voxels of a hull), each with edge cellSize centred on one of cellCenters, from a total mass or a density. Works for meshes that aren't closed.
Parameters
| Parameter | Type |
|---|---|
cellCenters | readonly Vector3[] |
cellSize | number |
specification | number | MassSpecification |
Returns
MassProperties
fromMesh()
static fromMesh(
geometry,
specification,
options?
): MassProperties;Defined in: packages/core/src/MassProperties.ts:111
Exact mass properties of the solid enclosed by a closed triangle mesh, with uniform density. The mesh must be closed and its faces must wind counter-clockwise when seen from outside, as three.js geometry does; otherwise an InvalidMeshError explains what is wrong.
Parameters
| Parameter | Type |
|---|---|
geometry | BufferGeometry |
specification | MassSpecification |
options? | MeshMassOptions |
Returns
MassProperties
placed()
placed(offset, rotation): MassProperties;Defined in: packages/core/src/MassProperties.ts:95
These mass properties turned by rotation and moved by offset, as for a collider placed in its body.
Parameters
| Parameter | Type |
|---|---|
offset | Vector3 |
rotation | Quaternion |
Returns
MassProperties
point()
static point(mass, position): MassProperties;Defined in: packages/core/src/MassProperties.ts:102
A point mass. On its own it can't rotate a body, so combine it with something that has extent.
Parameters
| Parameter | Type |
|---|---|
mass | number |
position | Vector3 |
Returns
MassProperties
sphere()
static sphere(
radius,
mass,
center?
): MassProperties;Defined in: packages/core/src/MassProperties.ts:54
A solid sphere.
Parameters
| Parameter | Type |
|---|---|
radius | number |
mass | number |
center? | Vector3 |
Returns
MassProperties
withMass()
withMass(mass): MassProperties;Defined in: packages/core/src/MassProperties.ts:159
The same shape with a different total mass; inertia scales in proportion.
Parameters
| Parameter | Type |
|---|---|
mass | number |
Returns
MassProperties
