Hide

This functions hides an entity. A hidden entity will be invisible, will not collide with other entities, and its 4x4 matrix will not be updated when the parent moves.

Syntax

Returns

If the entity is hidden, true is returned, otherwise false is returned.

Example

#include "Leadwerks.h"

using namespace Leadwerks;
Entity* entity[3] = { NULL };
int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = World::Create();
Camera* camera = Camera::Create();
camera->Move(0, 0, -3);
Light* light = DirectionalLight::Create();
light->SetRotation(35, 35, 0);

Model* model = Model::Box();
model->SetColor(0.0, 0.0, 1.0);

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;

Leadwerks::Time::Update();
world->Update();
world->Render();

model->Turn(0, Leadwerks::Time::GetSpeed(), 0);

if (window->KeyHit(Key::Space))
{
if (model->Hidden())
{
model->Show();
}
else
{
model->Hide();
}
}

context->SetBlendMode(Blend::Alpha);
context->DrawText("Press space to change.", 2, 2);
context->DrawText("Hidden:" + String(model->Hidden()), 2, 22);
context->Sync();
}
return 0;
}