@kognifai/cogsengine
    Preparing search index...

    Class ModelComponent

    Contains a model reference to instance as children to the entity the ModelComponent belongs to.

    Hierarchy (View Summary)

    Index

    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 ModelComponent

    Properties

    inheritMaterial: boolean

    If the model should inherit the material from the base entity.

    isTyped: boolean

    Internal flag set if component is a Cogs Core component.

    materialInstance: MaterialInstance

    Explicit material handle.

    Handle to a model resource that will be instanced onto the entity this ModelComponent belongs to.

    setCoordinate: boolean

    If model resource has a localOrigin property, forward this value to the TransformComponent's coordinate of the root that holds this entity.

    shareMaterial: boolean

    If the model should use shared model materials and not create it's own instances.

    waitForSubresources: boolean

    If the model should wait for all subresources (e.g. meshes) to be fully loaded before instantiating hierarchy.

    Accessors

    • 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.