|
Momentum Scripting v1
Deprecated API version. Use Momentum.v2 for new scripts.
|
Use Momentum.v2 for new scripts. Momentum.v1 is deprecated but remains available: existing scripts and imported dependencies can keep using their original names and units.
Browse the Momentum.v2 namespace for the updated classes, utility functions, and constants.
The table compares v1 and v2 getter names. Apply the same rename to the corresponding setter.
| Parameter | Previous getter | New getter |
|---|---|---|
| Translational stiffness | getTranslationalElasticity() | getTranslationalStiffness() |
| Rotational stiffness | getRotationalElasticity() | getRotationalStiffness() |
| Secondary spring stiffness | getElasticity() | getStiffness() |
| Distance spring stiffness | getSpringElasticity() | getSpringStiffness() |
| Motor position-holding damping | getDamping() | getHoldPositionDamping() |
| Material-pair stabilization | getDamping() | getAttenuation() |
Physical spring damping stays physical. Its getter/setter names and viscous damping coefficients remain available. Motor position-holding damping applies when spring-at-zero-speed mode is enabled and the target speed is zero.
Material-pair damping in v1 is a time in seconds. Attenuation in v2 is a number of integration steps, with no physical unit. Renaming the methods alone would change the meaning of the value.
Use these conversions, where tau is damping time and h is the active simulation timestep, both in seconds:
Replace a v1 pair.setDamping(dampingTime) call with:
Replace a v1 pair.getDamping() call with:
Obtain pair through the v2 API. The setter conversion utility converts material-pair damping time; it does not convert viscous spring damping coefficients.
The utilities use the active simulation timestep. If the timestep changes, reapply the setter conversion to preserve a damping time in seconds. A stored attenuation value alone does not retain a timestep-independent damping time.