Jump to content

Camera Pick and GetKeyValue doesnt work

Recommended Posts

if window:MouseHit(1) then
local pickinfo= PickInfo()
local p1 = Window:GetCurrent():GetMousePosition()
--local box = Model:Box()
if (self.camera:Pick(p1.x,p1.y,pickinfo,0.5,true)) then
if pickinfo.entity then
if pickinfo.entity:GetKeyValue("Button")~="" then


the above is the camera pick , I cant find anything .

The camera pick should Print the Key value of the box in the script below.

However, it prints nothing and I dont know why.


Script.localKeyValue = -1--string " Key Value Integer"


function Script:Start()



Share this post

Link to post

Works ok for me. Prints out -1. Granted I wouldn't use a pick with a radius as its not a precise pick, but it works in my test of the scripts. Keep in mind, you are setting the pick radius to be 0.5 meters. My suggestion would be to use System:Print()'s in your multiple if-statements to find where it is failing to get to the Print you want to see and to not use spherical picks, especially on small objects.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...