#title = Path_SelectedNode
#info = Insert an object by clicking on Scene | parented with selected object
#icon = clickPath.png


var()
{
 selected
 lastIstance
 istance
 pickedx
 pickedy
 pickedz
 istanceSelected
 
 field = "ENTITY"
}

input()
{
 fieldI = [field of istance]
}

onButtonClick()
{
 selected = onButtonClick.getType()
}

onSceneClick()
{
 lastIstance = scene.getLastSelected_AndSearchInnerField(field)
 scene.deselectAll()
 istance = scene.createIstance(selected,lastIstance|scene.getRoot())
 pickedx = onSceneClick.getX()
 pickedy = onSceneClick.getY()
 pickedz = onSceneClick.getZ()
 scene.setPosition(istance,pickedx,pickedy,pickedz)
 scene.selectIstance(istance)
}


