Map||doc136784

September 20, 2022

Map

Brief Introduction

Map is a class that manages scene instances. Each scene holds a root node and is accessed through the root attribute. The root node instance object type is workspace, which inherits from the instance abstract class. Its main purpose is to manage instances in the scene. All instance objects in the scene can be found through the root instance of the root node held by map. Every time a new instance is created, it needs to be set as the direct or indirect child of the root node of a scene. In this way, the instance is added to the scene, and the instance will run and render.

Attribute

string Name [ReadOnly]
Scene resource name
int ID [ReadOnly]
Scene ID
bool IsStatic [ReadOnly]
Whether it is a static scene
WorkSpace Root [ReadOnly]
Scene root node

Function

void Destroy()[ServerOnly]
Destroy scenario
bool IsValid()
Get whether the scene object reference is valid
bool RayCheckVector3 startPos, Vector3 direction, float distance )
Get whether the radiographic test has hit
bool BoxCheckVector3 center, Vector3 extend, float rotation )
Get whether the box detection has hit
bool SphereCheckVector3 center, Vector3 radius )
Get whether the ball shape detection has hit
table<HitResult> RayCastVector3 startPos, Vector3 direction, float distance, bool isThrough )
Get the hit information of radiographic testing
table<HitResult> BoxCastVector3 center, Vector3 extend, float rotation )
Get the hit information of box detection
table<HitResult> SphereCastVector3 center, Vector3 radius )
Get the hit information of ball shape detection

event

BindableEvent OnInstanceEnter
Triggered when an instance is added to the scene
BindableEvent OnInstanceLeave
Triggered when an instance is removed from the scene