Skip to content

Environment

Environment is the primary object intended for storing active objects in the place.

Inherits: Instance

Properties

  • CurrentCamera: Camera
  • Gravity: Vector3
  • PartDestroyHeight: number
  • AutoGenerateNavMesh: boolean

Methods

Raycast(origin: Vector3, direction: Vector3, maxDistance: number, ignoreList: { Instance }) → RayResult

Casts a ray from origin with a specified direction and returns a RayResult for the first hit object.

RaycastAll(origin: Vector3, direction: Vector3, maxDistance: number, ignoreList: { Instance }) → { RayResult }

Casts a ray from origin with a specified direction and returns a RayResult array for all hit objects.

OverlapSphere(origin: Vector3, radius: number, ignoreList: { Instance }) → { Instance }

Returns a list of instances intersecting with the sphere in the given position and radius.

OverlapBox(pos: Vector3, size: Vector3, rot: Vector3, ignoreList: { Instance }) → { Instance }

Returns a list of instances intersecting with the box in the given position, size and rotation.

RebuildNavMesh() → nil

Rebuilds the navigation mesh which determines the empty space where NPCs can pathfind in.

GetPointOnNavMesh(toPoint: Vector3) → Vector3

Returns a point on the navigation mesh at the given position.