@kognifai/cogsengine
    Preparing search index...

    Class SceneComponent

    Contains information on how the entity behaves in the scene. The scene component is used to represent an entity as a member of the scene, with behavior similar to that of a scene graph in terms of handling child visibility and picking. Using the scene component, an entity can store owning references to child entities in the children field, which are automatically cleaned up when the entity itself is removed from the scene. The scene component has interactions with several of the core systems, for example the LodSystem uses the children field to enumerate children when switching LoD is enabled.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    • Internal: Component constructor

      Parameters

      • type: string

        type of the component. Ex. "TransformComponent"

      • entity: Entity

        Owning entity. Entity only passed when wrapping existing entity.

      Returns SceneComponent

    Properties

    isTyped: boolean

    Internal flag set if component is a Cogs Core component.

    pickable: boolean

    If the entity this component is a member of should be pickable. Setting this field affects the entity this component is attached to, in addition to all child entities in the children member.

    visible: boolean

    If the entity this component is a member of should be visible. Setting this field affects the entity this component is attached to, in addition to all child entities in the children member. Setting visible to false will result in all entities in the subgraph formed by children being invisible. Setting the value to true results in all entities in the same graph being visible as long as no other component modifies any visibilities to false.

    Accessors

    • get children(): ChildCollection

      Contains all child entities owned by this component. All child entities are affected by the state of visible and pickable. This field is used by internal code to enumerate children whenever necessary. Clearing this collection will lead to the destruction of all child entities and components in these entities if no other owning shared pointers exist.

      Returns ChildCollection

    • get entity(): Entity

      Gets the optional owning entity

      Returns Entity

    • set entity(entity: Entity): void

      Internal: set owning entity.

      Parameters

      Returns void

    • get name(): string

      Component name == type. For compatibility

      Returns string

    • get type(): string

      Gets the type of the component. Ex. "TransformComponent", "SceneComponent" etc.

      Returns string

    Methods

    • Internal: Creates a new component of the given type (name). Component is wrapped when adding to an entity.

      Parameters

      • type: string

        Type of the component. Ex. "TransformComponent"

      Returns Component

      Created Cogs.js component.

    • Internal: Creates a new component being wrapped as an existing member of the entity

      Parameters

      • type: string

        Type of the component. Ex. "TransformComponent"

      • entity: Entity

        The owning entity

      Returns Component

      Created Cogs.js component.