Jump to content

pick


Rick
 Share

Recommended Posts

Doesn't the pick object have an x, y, z value in Lua?

 

pick = CameraPick(camera, Vec3(MouseX(), MouseY(), 1000), 0, 0)
	if pick~=nil then
		if pick.entity~=nil then
			Notify("x="..pick.x.." z="..pick.z)         -- this errors out saying it's not valid
               end
end

Link to comment
Share on other sites

The fps script that comes with Leadwerks has

 

pick=CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,2.0),0,0)

 

Adding pick to the first param gives me access violation and kills the editor.

 

Note this is in the Lua forum

Link to comment
Share on other sites

Any idea why I have to left click twice in the editor to get this code to run? Even that Notify("Inside click") won't run unless I click twice.

 

if MouseHit(1)==1 then
               Notify("Inside click")
	pick = CameraPick(camera, Vec3(MouseX(), MouseY(), 1000), 0, 0)
	if pick~=nil then
		if pick.entity~=nil then
			Notify("x="..pick.position.x.." z="..pick.position.z)
		end
	end
end

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
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.

 Share

×
×
  • Create New...