Skip to content

VR Traits

HoloScript includes 55 built-in traits that make objects spatial and interactive. Add traits with the @ prefix.

Interaction Traits

TraitDescription
@grabbableObject can be picked up with hands/controllers
@throwableObject can be thrown after grabbing
@holdableObject stays in hand until released
@clickableObject responds to click/tap events
@hoverableObject responds to hover/gaze events
@draggableObject can be dragged in 2D/3D space

Example

hsplus
orb weapon {
  @grabbable
  @throwable
  @holdable
  
  position: [0, 1, -2]
  
  on_grab: { play_sound("pickup") }
  on_throw: { damage_on_impact(50) }
}

Physics Traits

TraitDescription
@collidableObject participates in collision detection
@physicsObject has full physics simulation
@rigidRigid body dynamics
@kinematicScripted movement, affects other physics objects
@triggerCollision detection without physical response
@gravityObject affected by gravity

Example

hsplus
orb ball {
  @physics
  @gravity
  @collidable
  
  mass: 1.0
  bounciness: 0.8
  friction: 0.3
}

Visual Traits

TraitDescription
@glowingObject emits light
@emissiveSelf-illuminating material
@transparentObject has transparency
@reflectiveMirror-like surface
@animatedObject has animation states
@billboardAlways faces the camera

Example

hsplus
orb powerup {
  @glowing
  @animated
  @billboard
  
  glow_color: "#ff00ff"
  glow_intensity: 1.5
  animation: "pulse"
}

Networking Traits

TraitDescription
@networkedState syncs across network
@syncedSpecific properties sync
@persistentState persists between sessions
@ownedHas network ownership
@host_onlyOnly host can modify

Example

hsplus
orb shared_display {
  @networked
  @synced
  @persistent
  
  sync_rate: 20hz
  sync_properties: [position, rotation, state]
}

Behavior Traits

TraitDescription
@stackableObjects can stack on each other
@attachableObject can attach to other objects
@equippableCan be equipped to avatar slots
@consumableObject can be consumed/used up
@destructibleObject can be destroyed

Spatial Traits

TraitDescription
@anchorFixed position in world space
@trackedFollows a tracked point
@world_lockedLocked to world coordinates (AR)
@hand_trackedFollows hand position
@eye_trackedResponds to eye gaze

Audio Traits

TraitDescription
@spatial_audio3D positional audio
@ambientBackground audio source
@voice_activatedResponds to voice input

State Traits

TraitDescription
@stateHas reactive state
@reactiveAutomatically updates on state change
@observableState can be observed by other objects
@computedDerived state from other values

Combining Traits

Traits can be combined freely:

holo
object "MagicSword" {
  @grabbable
  @throwable
  @glowing
  @physics
  @spatial_audio
  @networked
  
  position: [0, 1, -2]
  glow_color: "#00ffff"
  
  on_grab: {
    play_sound("sword_draw")
    this.glow_intensity = 2.0
  }
}

Custom Trait Parameters

Some traits accept parameters:

hsplus
orb ball {
  @physics(mass: 2.0, drag: 0.1)
  @glowing(color: "#ff0000", intensity: 1.5)
  @networked(sync_rate: 30hz)
}

Released under the MIT License.