Class with common world manipulations.

This class includes methods for creating entities and common world rendering.

You can create blips, entities, cameras and more.

abstract

### Hierarchy

- World

## Index

### Constructors

- constructor

### Properties

- cloudHatDict
- currentCloudHat
- weatherDict

### Accessors

- Blackout
- CloudHat
- CloudHatOpacity
- CurrentDate
- NextWeather
- RenderingCamera
- Weather
- WeatherTransition

### Methods

- CreateAmbientPickup
- CreatePickup
- createBlip
- createCamera
- createPed
- createProp
- createRandomPed
- createRandomVehicle
- createVehicle
- destroyAllCameras
- drawLightWithRange
- drawLine
- drawMarker
- drawPoly
- drawSpotLight
- drawSpotLightWithShadow
- getAllPeds
- getAllPedsInGamePool
- getAllPickups
- getAllPickupsInGamePool
- getAllProps
- getAllPropsInGamePool
- getAllVehicles
- getAllVehiclesInGamePool
- getClosestObject
- raycast
- transitionToWeather

## Constructors

### constructor

- new World(): World

- #### Returns World

## Properties

### Static Private cloudHatDict

cloudHatDict: Map<CloudHat, string> = ...

- Defined in World.ts:991

### Static Private currentCloudHat

currentCloudHat: CloudHat = ...

- Defined in World.ts:989

### Static Private weatherDict

weatherDict: string[] = ...

- Defined in World.ts:1015

## Accessors

### Static Blackout

- set Blackout(value: boolean): void

- - Defined in World.ts:83

  Disables all emissive textures, street/building/vehicle lights. "EMP" effect.

  #### Parameters

  - ##### value: boolean

    On or off.

  #### Returns void

### Static CloudHat

- get CloudHat(): CloudHat
- set CloudHat(value: CloudHat): void

- - Defined in World.ts:92

  Get the current cloud hat.

  #### Returns CloudHat

  The current cloud hat type.

- - Defined in World.ts:101

  Set the current cloud hat.

  #### Parameters

  - ##### value: CloudHat

    The type of cloud hat.

  #### Returns void

  The current cloud hat type.

### Static CloudHatOpacity

- get CloudHatOpacity(): number
- set CloudHatOpacity(value: number): void

- - Defined in World.ts:117

  Get the opacity of current cloud hat. Value is between 0-1.

  #### Returns number

  The current cloud opacity between 0.0 and 1.0

- - Defined in World.ts:126

  Set opacity of current cloud hat between 0-1.

  #### Parameters

  - ##### value: number

    Opacity between 0.0 and 1.0

  #### Returns void

  The current cloud opacity between 0.0 and 1.0

### Static CurrentDate

- get CurrentDate(): Date
- set CurrentDate(date: Date): void

- - Defined in World.ts:59

  Get the current date in the world.

  #### Returns Date

  The current date.

- - Defined in World.ts:73

  Set the current date of the world.

  #### Parameters

  - ##### date: Date

  #### Returns void

  The current date.

### Static NextWeather

- get NextWeather(): Weather
- set NextWeather(value: Weather): void

- - Defined in World.ts:192

  Get the next weather type.

  #### Returns Weather

  The Weather type

- - Defined in World.ts:232

  Set weather type instantly. Similar to World.transitionToWeather with duration 0.

  #### Parameters

  - ##### value: Weather

  #### Returns void

  The Weather type

### Static RenderingCamera

- get RenderingCamera(): Camera
- set RenderingCamera(value: Camera): void

- - Defined in World.ts:27

  Get the current camera that's rendering.

  #### Returns Camera

  The camera that's currently used.

- - Defined in World.ts:45

  Set the rendering camera. World.RenderingCamera = null to reset.

      const position = new Vector3(-802.311, 175.056, 72.8446);
      const myCamera = World.createCamera(position, new Vector3(0,0,0), 180);
      World.RenderingCamera = myCamera;

      // Reset to default cam
      World.RenderingCamera = null;

  #### Parameters

  - ##### value: Camera

    The camera to render.

  #### Returns void

  The camera that's currently used.

### Static Weather

- get Weather(): Weather
- set Weather(value: Weather): void

- - Defined in World.ts:135

  Get the current weather type.

  #### Returns Weather

  The current type of weather.

- - Defined in World.ts:177

  Set the current weather.

  #### Parameters

  - ##### value: Weather

    Type of weather to set.

  #### Returns void

  The current type of weather.

### Static WeatherTransition

- get WeatherTransition(): [string | Weather, string | Weather, number]
- set WeatherTransition(transition: [string | Weather, string | Weather, number]): void

- - Defined in World.ts:242

  Doesn't work

  #### Returns [string | Weather, string | Weather, number]

- - Defined in World.ts:250

  Doesn't work

  #### Parameters

  - ##### transition: [string | Weather, string | Weather, number]

  #### Returns void

## Methods

### Static CreateAmbientPickup

- CreateAmbientPickup(type: PickupType, position: Vector3, model: Model, value: number): Promise<null | Prop>

- - Defined in World.ts:523

  Creates an ambient pickup.

  #### Parameters

  - ##### type: PickupType

    The [[`PickupType`]] of the pickup.

  - ##### position: Vector3

    The position where it should be spawned.

  - ##### model: Model

    The model.

  - ##### value: number

    The value tied to the pickup.

  #### Returns Promise<null | Prop>

  The pickup in form of a Prop.

### Static CreatePickup

- CreatePickup(type: PickupType, position: Vector3, model: Model, value: number, rotation?: Vector3): Promise<null | Pickup>

- - Defined in World.ts:476

  Create a pickup in a specific position in the world with a specified type and value.

  #### Parameters

  - ##### type: PickupType

    The [[`PickupType`]] of pickup.

  - ##### position: Vector3

    The position in the world it should be spawned.

  - ##### model: Model

    The model of the spawned pickup.

  - ##### value: number

    Give a value for the pickup when picked up.

  - ##### Optional rotation: Vector3

    If set, create a rotating pickup with this rotation.

  #### Returns Promise<null | Pickup>

  Pickup object.

### Static createBlip

- createBlip(position: Vector3, radius?: number): Blip

- - Defined in World.ts:286

  Creates a blip at a given position and optionally radius.

      const position = new Vector3(-802.311, 175.056, 72.8446);
      const myStoreBlip = World.createBlip(position, 5.0);
      myStoreBlip.Sprite = BlipSprite.Store;

  #### Parameters

  - ##### position: Vector3

    World coordinate of blip.

  - ##### Optional radius: number

    (Optional) Radius of where blip should be shown.

  #### Returns Blip

  Blip object.

### Static createCamera

- createCamera(position: Vector3, rotation: Vector3, fieldOfView: number): Camera

- - Defined in World.ts:306

  Creates a camera using 'DEFAULT_SCRIPTED_CAMERA'.

      const position = new Vector3(-802.311, 175.056, 72.8446);
      const myCamera = World.createCamera(position, new Vector3(0,0,0), 180);

  #### Parameters

  - ##### position: Vector3

    World coordinate where the camera should render.

  - ##### rotation: Vector3

    Rotation of camera relative to world.

  - ##### fieldOfView: number

    Field of view angle of camera.

  #### Returns Camera

  Camera object.

### Static createPed

- createPed(model: Model, position: Vector3, heading?: number, isNetwork?: boolean): Promise<null | Ped>

- - Defined in World.ts:338

  Create a ped at a desired location.

      const position = new Vector3(-802.311, 175.056, 72.8446);
      const model = new Model("a_f_m_beach_01");
      const myPed = await World.createPed(model, position);

  #### Parameters

  - ##### model: Model

    Ped model to be spawned.

  - ##### position: Vector3

    World position (coordinates) of Ped spawn.

  - ##### heading: number = 0

    Heading of Ped when spawning.

  - ##### isNetwork: boolean = true

  #### Returns Promise<null | Ped>

  Ped object.

### Static createProp

- createProp(model: Model, position: Vector3, dynamic: boolean, placeOnGround: boolean, isNetwork?: boolean): Promise<null | Prop>

- - Defined in World.ts:444

  Spawns a `Prop` at the given position.

      const position = new Vector3(-802.311, 175.056, 72.8446);
      const model = new Model("prop_barrel_02a");
      const myBarrelProp = await World.createProp(model, position, false, true);

  #### Parameters

  - ##### model: Model

    The `Model` to spawn (must be a Prop)

  - ##### position: Vector3

    Location of Prop

  - ##### dynamic: boolean

    If set to true, the Prop will have physics otherwise it's static.

  - ##### placeOnGround: boolean

    If set to true, sets the Prop on the ground nearest to position.

  - ##### isNetwork: boolean = true

  #### Returns Promise<null | Prop>

  Prop object.

### Static createRandomPed

- createRandomPed(position: Vector3): Ped

- - Defined in World.ts:363

  Creates a `Ped` with a random model.

      const position = new Vector3(-802.311, 175.056, 72.8446);
      const randomPed = World.createRandomPed(position);

  #### Parameters

  - ##### position: Vector3

    World coordinate of Ped spawn.

  #### Returns Ped

  Ped object.

### Static createRandomVehicle

- createRandomVehicle(position: Vector3, heading?: number, isNetwork?: boolean): Promise<null | Vehicle>

- - Defined in World.ts:409

  Create a random vehicle at a desired location.

      const position = new Vector3(-802.311, 175.056, 72.8446);
      const randomVehicle = await World.createRandomVehicle(position);

  #### Parameters

  - ##### position: Vector3

    World position (coordinates) of Vehicle spawn.

  - ##### heading: number = 0

    Heading of Vehicle when spawning.

  - ##### isNetwork: boolean = true

  #### Returns Promise<null | Vehicle>

  Vehicle object.

### Static createVehicle

- createVehicle(model: Model, position: Vector3, heading?: number, isNetwork?: boolean): Promise<null | Vehicle>

- - Defined in World.ts:382

  Create a vehicle at a desired location.

      const position = new Vector3(-802.311, 175.056, 72.8446);
      const model = new Model("adder");
      const myVehicle = await World.createVehicle(model, position);

  #### Parameters

  - ##### model: Model

    Vehicle model to be spawned.

  - ##### position: Vector3

    World position (coordinates) of Vehicle spawn.

  - ##### heading: number = 0

    Heading of Vehicle when spawning.

  - ##### isNetwork: boolean = true

  #### Returns Promise<null | Vehicle>

  Vehicle object.

### Static destroyAllCameras

- destroyAllCameras(): void

- - Defined in World.ts:269

  Destroys all existing cameras and sets your rendering camera back to GameplayCam.

  #### Returns void

### Static drawLightWithRange

- drawLightWithRange(pos: Vector3, color: Color, range: number, intensity: number): void

- - Defined in World.ts:627

  Creates a light in the world with a certain length (range).

  #### Parameters

  - ##### pos: Vector3

    World coordinate where to draw the light.

  - ##### color: Color

    RGB colors of the light.

  - ##### range: number

    How far to draw the light.

  - ##### intensity: number

    Intensity of the light ("alpha").

  #### Returns void

### Static drawLine

- drawLine(start: Vector3, end: Vector3, color: Color): void

- - Defined in World.ts:724

  Draws a line in the world. It's not possible to change thickness.

  #### Parameters

  - ##### start: Vector3

    World coordinate of start position of line.

  - ##### end: Vector3

    World coordinate of end position of line.

  - ##### color: Color

    RGB color of line.

  #### Returns void

### Static drawMarker

- drawMarker(type: MarkerType, position: Vector3, direction: Vector3, rotation: Vector3, scale: Vector3, color: Color, bobUpAndDown?: boolean, faceCamera?: boolean, rotateY?: boolean, textureDict?: string, textureName?: string, drawOnEntity?: boolean): void

- - Defined in World.ts:577

  Draw a marker at a desired location. Careful! Must be drawn every tick.

      const position = new Vector3(-802.311, 175.056, 72.8446);
      const zeroVector = new Vector3(0,0,0);

      setTick(() => {
       World.drawMarker(MarkerType.ThickChevronUp, position, zeroVector, zeroVector, 1.0, new Color(255,0,0));
      })

  #### Parameters

  - ##### type: MarkerType

    Type of marker.

  - ##### position: Vector3

    Location of marker.

  - ##### direction: Vector3

    Direction facing.

  - ##### rotation: Vector3

    World rotation.

  - ##### scale: Vector3

    Size of marker.

  - ##### color: Color

    Color of marker.

  - ##### bobUpAndDown: boolean = false

    Animated movement along marker's own X axis.

  - ##### faceCamera: boolean = false

    Rendering marker facing rendering camera.

  - ##### rotateY: boolean = false

    Rotate along Y axis.

  - ##### textureDict: string = ''

    Custom texture dictionary for custom marker.

  - ##### textureName: string = ''

    Custom texture name for custom marker.

  - ##### drawOnEntity: boolean = false

    Render the marker on an entity.

  #### Returns void

### Static drawPoly

- drawPoly(vertexA: Vector3, vertexB: Vector3, vertexC: Vector3, color: Color): void

- - Defined in World.ts:736

  Draw polygon in the world.

  #### Parameters

  - ##### vertexA: Vector3

    World coordinate of first point.

  - ##### vertexB: Vector3

    World coordinate of second point.

  - ##### vertexC: Vector3

    World coordinate of third point.

  - ##### color: Color

    RGB color of polygon.

  #### Returns void

### Static drawSpotLight

- drawSpotLight(pos: Vector3, dir: Vector3, color: Color, distance: number, brightness: number, roundness: number, radius: number, fadeOut: number): void

- - Defined in World.ts:648

  Creates a light in the world. More configurable than World.drawLightWithRange.

  #### Parameters

  - ##### pos: Vector3

    World coordinate of spotlight.

  - ##### dir: Vector3

    Direction to face spotlight.

  - ##### color: Color

    RGB colors of spotlight.

  - ##### distance: number

    The maximum distance the spotlight can reach.

  - ##### brightness: number

    Brightness of the spotlight.

  - ##### roundness: number

    "Smoothness" of the edge of the spotlight.

  - ##### radius: number

    Radius size of spotlight.

  - ##### fadeOut: number

    Falloff size of the spotlight's edge.

  #### Returns void

### Static drawSpotLightWithShadow

- drawSpotLightWithShadow(pos: Vector3, dir: Vector3, color: Color, distance: number, brightness: number, roundness: number, radius: number, fadeOut: number): void

- - Defined in World.ts:688

  Creates a light in the world. Same as World.drawSpotlight, but also draws shadows.

  #### Parameters

  - ##### pos: Vector3

    World coordinate of spotlight.

  - ##### dir: Vector3

    Direction to face spotlight.

  - ##### color: Color

    RGB colors of spotlight.

  - ##### distance: number

    The maximum distance the spotlight can reach.

  - ##### brightness: number

    Brightness of the spotlight.

  - ##### roundness: number

    "Smoothness" of the edge of the spotlight.

  - ##### radius: number

    Radius size of spotlight.

  - ##### fadeOut: number

    Falloff size of the spotlight's edge.

  #### Returns void

### Static getAllPeds

- getAllPeds(): Ped[]

- - Defined in World.ts:855

  Get all `Ped` entities in your own scope.

  We recommend using getAllPedsInGamePool instead.

  #### Returns Ped[]

  Array of Peds.

### Static getAllPedsInGamePool

- getAllPedsInGamePool(): Ped[]

- - Defined in World.ts:886

  Get all `Ped` entities using the GetGamePool.

  #### Returns Ped[]

  Array of Peds.

### Static getAllPickups

- getAllPickups(): Pickup[]

- - Defined in World.ts:949

  Get all `Pickup` entities in your own scope.

  We recommend using getAllPickupsInGamePool instead.

  #### Returns Pickup[]

  Array of Pickups.

### Static getAllPickupsInGamePool

- getAllPickupsInGamePool(): Pickup[]

- - Defined in World.ts:980

  Get all `Pickup` entities using the GetGamePool.

  #### Returns Pickup[]

  Array of Pickups.

### Static getAllProps

- getAllProps(): Prop[]

- - Defined in World.ts:808

  Get all `Prop` entities in your own scope.

  We recommend using getAllPropsInGamePool instead.

  #### Returns Prop[]

  Array of Props.

### Static getAllPropsInGamePool

- getAllPropsInGamePool(): Prop[]

- - Defined in World.ts:839

  Get all `Prop` entities using the GetGamePool.

  #### Returns Prop[]

  Array of Props.

### Static getAllVehicles

- getAllVehicles(): Vehicle[]

- - Defined in World.ts:902

  Get all `Vehicle` entities in your own scope.

  We recommend using getAllVehiclesInGamePool instead.

  #### Returns Vehicle[]

  Array of Vehicles.

### Static getAllVehiclesInGamePool

- getAllVehiclesInGamePool(): Vehicle[]

- - Defined in World.ts:933

  Get all `Vehicle` entities using the GetGamePool.

  #### Returns Vehicle[]

  Array of Vehicles.

### Static getClosestObject

- getClosestObject(model: Model, coords: Vector3, radius?: number, isMission?: boolean): null | Prop

- - Defined in World.ts:792

  Gets the closest object of this model

  #### Parameters

  - ##### model: Model

  - ##### coords: Vector3

  - ##### radius: number = 25.0

  - ##### isMission: boolean = false

  #### Returns null | Prop

### Static raycast

- raycast(source: Vector3, direction: Vector3, maxDistance: number, options: IntersectOptions, ignoreEntity: Entity): RaycastResult

- - Defined in World.ts:764

  Cast ("shoot") a ray in a certain direction to detect entities in the way.

  #### Parameters

  - ##### source: Vector3

    Starting position of raycast.

  - ##### direction: Vector3

    Direction to cast a ray to.

  - ##### maxDistance: number

    Max distance to cast the ray.

  - ##### options: IntersectOptions

    Possible entity types to detect.

  - ##### ignoreEntity: Entity

    An entity to ignore (usually player's Ped).

  #### Returns RaycastResult

  RaycastResult object.

### Static transitionToWeather

- transitionToWeather(weather: Weather, duration: number): void

- - Defined in World.ts:260

  Transition to different weather type within a certain time.

  #### Parameters

  - ##### weather: Weather

    Weather type to change to.

  - ##### duration: number

    Time for full weather change (in milliseconds);

  #### Returns void

Generated using TypeDoc