Hology
Hology
Hology
  • 👋Welcome to Hology Docs
  • Getting started
    • Introduction to Hology
    • The first steps
    • Editor basics
      • Flying in scenes
      • Placing objects
      • Select objects
      • Transform
      • Grouping objects
      • Duplicate
    • Starter project - Third person shooter
  • Tutorials
    • Rolling ball - Gameplay programming
    • Character movement programming
    • Character AI behavior
  • Release
    • Distribution
      • Discord Activities
      • Facebook Instant Games
      • Upload to Itch.io
      • Host with GitHub Pages
      • Publishing to Steam
      • iOS and Android
  • Assets
    • 3D Models
      • Custom collision shapes
      • Material slots
    • Materials
    • Textures
    • Prefabs
  • Gameplay
    • Actors
      • Creating actor classes
      • Actor parameters
      • Actor components
      • Actor lifecycle
      • Spawning actors
      • Moving actors
    • Services
      • Load assets
    • Player input
    • Collision detection
    • Physics
      • Physics body types
      • Applying forces
      • Ray casting
    • Trigger volumes
    • Character movement
    • Pointer events
    • Animation
      • Animation system
      • Character Animation
      • Animation State Machine
    • Sound
      • Audio parameter
    • World
    • Navigation
  • Shaders
    • Introduction to shaders
    • Creating shaders
    • Shader parameters
    • Typescript shaders
      • Types
      • Math functions
      • Attributes
      • Varying
      • Uniforms
      • Textures
      • Arrays
      • Select
      • Lighting
    • Painted materials
    • Water shader tutorial
  • Level design
    • Landscape sculpting
    • Landscape painting
    • Grass
  • User Interfaces
    • Creating user interfaces
    • Using React
    • VR
  • Visual Effects
    • Introduction to VFX
    • VFX Assets
  • Integrations
    • Arcweave
Powered by GitBook
On this page
  1. Gameplay

World

The World service is used for code that needs to interact with the world like spawning actors, finding actors or controlling directional light.

Access the world by injecting it in your services, actors and component classes.


@Service()
class Game extends GameInstance {
    private world = inject(World)
    
    onStart() {
        
    }
    
}

Directional Light

By default, every scene has directional light which produces shadows. You may want to access this to update the direction or intensity at runtime.

@Service()
class Game extends GameInstance {
    private world = inject(World)
    
    onStart() {
        this.world.directionalLight.intensity = 0.2 
        this.world.directionalLight.direction.applyAxisAngle(new THREE.Vector3(0,0,1), Math.PI / 2)

    }
    
}

The directional light exposes the following fields

  • direction: Vector3 - The direction vector can be updated to change the direction of the light. This can be used to emulate a sun.

  • intensity: number - How bright the light should be.

  • position: Vector3 - The position of the directional light instance. This can not be changed; instead, change the direction.

PreviousAudio parameterNextNavigation

Last updated 11 months ago