Scene class structure||doc136787
September 20, 2022
Scene management structure
World is a class for managing scenes, which is responsible for creating and finding scenes. By default, the project will have a scene resource named "map001". After starting the game, the "map001" scene will be created by default and the player entity will be added to the scene.
Scene instance object structure
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.
Instance class inheritance relationship
The figure does not contain all instance classes, but is only used as an example reference
Instance is the abstract base class of all instance classes in blockmango scene. All instances created in the scene tree inherit from instance. The instance base class contains the most basic name, type, ID and other data information of the instance. Its main function is to find, add, delete and other operations related to the parent-child level. All instance objects inherited from instance need to pass instance New. This class is abstract and cannot be created directly.
Workspace inherits from instance and has no additional functions. The main purpose of the workspace is to manage instances in the scene. The workspace is the root node of the scene, which can be accessed through the scene Root accesses the workspace. This class is automatically created when creating a scene, and cannot be created through code.
Movablenode inherits from instance and provides additional spatial transformation information and movement functions. It is an abstract base class for all movable objects. The main function of a movable node is to control the movement, rotation, scaling, etc. of an instance in the scene. When an instance inherited from this class moves, rotates, scales, it will drive the child object to carry out spatial transformation. For example, when the parent node moves, the child node will also move with it. This class is abstract and cannot be created directly.
Basepart inherits from movablenode and provides additional functions of material information, physical attribute information and physical simulation. It is an abstract base class of parts. The main purpose of parts is to build scenes and do physical simulation and interaction. This class is abstract and cannot be created directly.
Part inherits from basepart and provides additional shape information. The basic part is the most basic physical unit with several basic shapes. The main purpose of basic parts is to build scenes and do physical simulation and interaction. Through instance New ("part") to create part instances.
Meshpart inherits from basepart and provides additional mesh body information. Mesh body parts are physical units with custom shapes. The main purpose of mesh body parts is to build scenes and do physical simulation and interaction. Dynamic creation is not supported for mesh body parts.
Folder inherits from instance and has no additional functions. The main purpose of folders is to manage instances. Through instance New ("folder") to create a folder instance.
Dec inherits from instance and provides additional information such as mapping, color, tiling rate, etc. The main purpose of decals is to attach to a certain surface of parts to play a decorative effect. Through instance New ("Dec") to create a Dec instance.
Baseconstraint inherits from instance and provides additional information such as connected master-slave nodes. It is an abstract base class of constraints. The main uses of constraint base classes areConnect two parts to form the connection relationship of mechanical structure.This class is abstract and cannot be created directly.
Weldconstraint inherits from baseconstraint and has no additional functions. The main purpose of splice constraints isFixing the constraint relationship between the relative positions of two parts is equivalent to welding the parts together.Through instance New ("weldconstraint") to create an instance of weldconstraint.