Environment¶
Inherits Instance
Environment is the primary object intended for storing active objects in the place.
Static Class
This object is a static class. It can be accessed by using its name as a keyword.
Additionally, it cannot be created in the creator menu or with Instance.New().
Not newable
This object cannot be created by scripts using Instance.New().
Properties¶
CurrentCamera : Camera¶
Determines the current camera which player is using to view
Gravity : Vector3¶
The direction and strength of gravity in the world.
PartDestroyHeight : number¶
The height at which unanchored parts are destroyed when they fall below it.
AutoGenerateNavMesh : boolean¶
Determines whether or not to automatically build a navigation mesh for NPC pathfinding. This property is disabled by default so there are no performance issues with larger maps.
Methods¶
Raycast → RayResult¶
Casts a ray from origin with a specified direction and returns a RayResult for the first hit object.
RaycastAll → table¶
Casts a ray from origin with a specified direction and returns a RayResult array for all hit objects.
OverlapSphere → table¶
Returns a list of instances intersecting with the sphere in the given position and radius.
OverlapBox → table¶
Returns a list of instances intersecting with the box in the given position, size and rotation.
RebuildNavMesh → nil¶
Parameters: ``
Rebuilds the navigation mesh which determines the empty space where NPCs can pathfind in.
GetPointOnNavMesh → Vector3¶
Parameters: toPoint [ Vector3 ]
Returns a point on the navigation mesh at the given position.