GetPickMode

This function gets an entity's pick mode.

Syntax

Parameters

Example

#include "Leadwerks.h"

using namespace Leadwerks;
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, -8);
Light* light = DirectionalLight::Create();
light->SetRotation(35, 35, 0);

//Create a model
Model* model1 = Model::Box();
model1->SetPosition(2, 0, 0);

Model* model2 = Model::Box();
model2->SetPosition(-2, 0, 0);
model2->SetPickMode(0);// Disable picking on the first hit entity

//Create a sphere to indicate where the pick hits
Model* picksphere = Model::Sphere();
picksphere->SetColor(1.0, 0.0, 0.0);
picksphere->SetPickMode(0);

float pickradius = 0.5;
picksphere->SetScale(pickradius*2.0);

world->Update();
PickInfo pickinfo;
if (world->Pick(-10, 0.75, 0, 10, 0.75, 0, pickinfo, pickradius, true))
{
picksphere->SetPosition(pickinfo.position);

//Make sure the pick mode equals Entity::PolygonPick
Debug::Assert(pickinfo.entity->GetPickMode() == Entity::PolygonPick);
}
else
{
picksphere->Release();
}

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

Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync();
}
return 0;
}