ModelRenderer

Namespace:

namespace Lenga\Engine\Core;

class ModelRenderer

Methods

loadModel

public function loadModel(string $modelPath)

loadAnimations

public function loadAnimations(string $animationPath)

getAnimationCount

public function getAnimationCount()

getAnimationNames

public function getAnimationNames()

getColor

public function getColor()

Example

use Lenga\Engine\Core\Behaviour;
use Lenga\Engine\Core\ModelRenderer;

class AnimatedCharacter extends Behaviour
{
    public function start(): void
    {
        $renderer = $this->getComponent(ModelRenderer::class);
        $renderer->loadModel('assets/models/player.gltf');
        $renderer->loadAnimations('assets/animations/player.anim');

        $animCount = $renderer->getAnimationCount();
        $animNames = $renderer->getAnimationNames();
        Debug::log('Available animations: ' . implode(', ', $animNames));
    }
}