Skip to content

Physics Traits

Part of the HoloScript Traits reference. Browse: Interaction · AI & Behavior · All Traits

Physics Traits

@cloth

Real-time cloth simulation with wind, gravity, and tearing.

hsplus
object Cape @cloth(resolution: 32, stiffness: 0.8) {
  geometry: 'plane'
}
ConfigTypeDefaultDescription
resolutionnumber32Grid resolution (NxN vertices)
stiffnessnumber0.8Constraint stiffness (0-1)
dampingnumber0.01Velocity damping
massnumber1.0Total cloth mass
gravity_scalenumber1.0Gravity multiplier
wind_responsenumber0.5Wind force multiplier
self_collisionbooleanfalseEnable self-collision
tearablebooleanfalseAllow tearing
tear_thresholdnumber100Force required to tear
pin_verticesArray[]Pinned vertex coordinates

Events:

  • cloth_create - Simulation initialized
  • cloth_destroy - Simulation destroyed
  • cloth_pin_vertex - Vertex pinned
  • cloth_unpin_vertex - Vertex unpinned
  • cloth_tear - Cloth torn (if tearable)

@fluid

Particle-based fluid simulation.

hsplus
object Water @fluid(particle_count: 10000, viscosity: 0.01) {
  geometry: 'cube'
}
ConfigTypeDefaultDescription
particle_countnumber10000Maximum particles
viscositynumber0.01Fluid thickness
surface_tensionnumber0.1Surface tension force
colorstring'#0088ff'Fluid color
spawn_ratenumber100Particles per second
lifetimenumber10Particle lifetime (seconds)
gravity_scalenumber1.0Gravity multiplier
collision_enabledbooleantrueCollide with objects

Events:

  • fluid_create - Simulation started
  • fluid_destroy - Simulation stopped
  • fluid_add_emitter - Emitter added
  • fluid_remove_emitter - Emitter removed

@rope

Segment-based rope physics with tension and slack.

hsplus
object SwingingRope @rope(segments: 20, length: 5) {
  start: [0, 5, 0]
  end: [0, 0, 0]
}
ConfigTypeDefaultDescription
segmentsnumber10Number of segments
lengthnumber1.0Total rope length (meters)
stiffnessnumber0.9Segment stiffness
dampingnumber0.1Velocity damping
gravitynumber9.81Gravity force
thicknessnumber0.02Visual thickness
colorstring'#8B4513'Rope color
collision_enabledbooleantrueCollide with objects

State:

  • points - Array of {x, y, z} positions (segments + 1 points)
  • isSimulating - Whether simulation is active
  • tension - Current rope tension

Events:

  • rope_create - Rope initialized
  • rope_destroy - Rope destroyed
  • rope_break - Rope broken (if breakable)

@soft_body

Deformable soft body physics.

hsplus
object JellyBlob @soft_body(pressure: 1.0, volume_conservation: 0.9) {
  geometry: 'sphere'
}
ConfigTypeDefaultDescription
pressurenumber1.0Internal pressure
volume_conservationnumber0.9How much volume is preserved
stiffnessnumber0.5Edge stiffness
dampingnumber0.1Velocity damping
massnumber1.0Total mass

Events:

  • soft_body_create - Simulation initialized
  • soft_body_destroy - Simulation destroyed
  • soft_body_deform - Significant deformation occurred

@buoyancy

Water buoyancy simulation.

hsplus
object Boat @buoyancy(water_level: 0, density: 0.7) {
  geometry: 'model/boat.glb'
}
ConfigTypeDefaultDescription
water_levelnumber0Y-position of water surface
densitynumber1.0Object density (< 1 floats)
dragnumber0.5Water resistance
angular_dragnumber0.3Rotational resistance

@destruction

Breakable objects with fracture simulation.

hsplus
object Vase @destruction(fracture_count: 8, break_threshold: 50) {
  geometry: 'model/vase.glb'
}
ConfigTypeDefaultDescription
fracture_countnumber8Number of fragments
break_thresholdnumber50Impact force to break
debris_lifetimenumber5Seconds before cleanup
explosion_forcenumber10Fragment scatter force

Events:

  • destruction_break - Object broken
  • destruction_fragment - Fragment created

See Also

Released under the MIT License.