// calculate world position and direction vectors
Vec pos, dir; ScreenToPosDir(Vec2(0,0),pos,dir);
PhysHit phys_hit; if(Physics.ray(pos,dir*ViewportActive.range,&phys_hit)) // if ray test hit an actor
{
if(phys_hit.obj) // if the actor comes from an object
{
if(Game::Item *item=CAST(Game::Item,phys_hit.obj)) // if the object is an item
{
coord = phys_hit.plane.pos;
Items.New().createDefault();
Items.absElm(Items.absElms()-1).actor.gravity(false);
Items.absElm(Items.absElms()-1).actor.collision(false);
Items.absElm(Items.absElms()-1).lod = &Items.absElm(Items.absElms()-1).mesh->createLod(1);
Items.absElm(Items.absElms()-1).lod->scale(Vec(1,1,1));
wall.lod = &wall.mesh->createLod(1);
Items.absElm(Items.absElms()-1).lod->setMaterial(Materials("../data/mtrl/brick/0.mtrl"),0).setRender();
Items.absElm(Items.absElms()-1).lod->transform(Matrix(coord));
//Items.absElm(Items.absElms()-1).actor.pos(coord);
//Items.absElm(Items.absElms()-1).mesh->transform(Matrix(coord));
//Items.absElm(Items.absElms()-1).mesh->setNormals();
Csg(*wall.lod,*Items.absElm(Items.absElms()-1).lod,SEL_SUB,NULL);
wall.lod->setRender();
//Items.removeAbs(Items.absElms()-1);
}
}