GetPickRadius

This functions gets the entity radius for pick operations.

Syntax

Returns

Returns the entity pick radius.

Example

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()

local camera = Camera:Create()
camera:SetRotation(35,0,0)
camera:Move(0,0,-5)

local light = DirectionalLight:Create()
light:SetRotation(35,35,0)

camera:SetProjectionMode(2)
camera:SetZoom(50)

--Create a model
local spherescale = 3.6
local model = Model:Sphere()
model:SetPickMode(Entity.SpherePick)
model:SetPickRadius(spherescale/2.0)
model:SetScale(model:GetPickRadius()*2.0)

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

local pickradius = 0.25
picksphere:SetScale(pickradius*2.0)

local pickinfo = PickInfo()
if (world:Pick(Vec3(-10,1,0),Vec3(10,1,0),pickinfo,pickradius,true)) then
picksphere:SetPosition(pickinfo.position)
else
picksphere:Release()
end

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

Time:Update()
world:Update()
world:Render()

context:Sync()
end