Options
All
  • Public
  • Public/Protected
  • All
Menu

Class World

Class with common world manipulations.

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

Hierarchy

  • World

Index

Accessors

Static Blackout

  • set Blackout(value: boolean): void
  • Disables all emissive textures, street/building/vehicle lights. "EMP" effect.

    Parameters

    • value: boolean

    Returns void

Static CloudHat

Static CloudHatOpacity

  • get CloudHatOpacity(): number
  • set CloudHatOpacity(value: number): void
  • Get the opacity of current cloud hat. Value is between 0-1.

    Returns number

  • Set opacity of current cloud hat between 0-1.

    Parameters

    • value: number

    Returns void

Static CurrentDate

  • get CurrentDate(): Date
  • set CurrentDate(date: Date): void
  • Get the current date in the world.

    Returns Date

  • Set the current date of the world.

    Parameters

    • date: Date

    Returns void

Static NextWeather

  • Get the next weather type.

    Returns Weather

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

    Parameters

    Returns void

Static RenderingCamera

  • get RenderingCamera(): Camera
  • set RenderingCamera(value: Camera): void
  • Get the current camera that's rendering.

    Returns Camera

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

    Parameters

    Returns void

Static Weather

Static WeatherTransition

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

Methods

Static createBlip

  • Creates a blip at a given position and optionally radius.

    Parameters

    • position: Vector3

      World coordinate of blip.

    • Optional radius: number

      (Optional) Radius of where blip should be shown.

    Returns Blip

    Blip object.

Static createCamera

  • Creates a camera using 'DEFAULT_SCRIPTED_CAMERA'.

    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): Promise<Ped>
  • Create a ped at a desired location.

    Parameters

    • model: Model

      Ped model to be spawned.

    • position: Vector3

      World position (coordinates) of Ped spawn.

    • Default value heading: number = 0

      Heading of Ped when spawning.

    Returns Promise<Ped>

    Ped object.

Static createRandomPed

  • Creates a ped with a random model.

    Parameters

    • position: Vector3

      World coordinate of Ped spawn.

    Returns Ped

    Ped object.

Static createRandomVehicle

  • createRandomVehicle(position: Vector3, heading?: number): Promise<Vehicle>
  • Create a random vehicle at a desired location.

    Parameters

    • position: Vector3

      World position (coordinates) of Vehicle spawn.

    • Default value heading: number = 0

      Heading of Vehicle when spawning.

    Returns Promise<Vehicle>

    Vehicle object.

Static createVehicle

  • Create a vehicle at a desired location.

    Parameters

    • model: Model

      Vehicle model to be spawned.

    • position: Vector3

      World position (coordinates) of Vehicle spawn.

    • Default value heading: number = 0

      Heading of Vehicle when spawning.

    Returns Promise<Vehicle>

    Vehicle object.

Static destroyAllCameras

  • destroyAllCameras(): void
  • 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
  • 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

  • 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
  • Draw a marker at a desired location.

    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.

    • Default value bobUpAndDown: boolean = false

      Animated movement along marker's own X axis.

    • Default value faceCamera: boolean = false

      Rendering marker facing rendering camera.

    • Default value rotateY: boolean = false

      Rotate along Y axis.

    • Default value textureDict: string = null

      Custom texture dictionary for custom marker.

    • Default value textureName: string = null

      Custom texture name for custom marker.

    • Default value drawOnEntity: boolean = false

      Render the marker on an entity.

    Returns void

Static drawPoly

  • 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
  • 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
  • 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 raycast

  • 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
  • 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