Hi, I'm finally getting back into coding after a break making scenes. I've reached a block here and maybe someone can help out...
I want to pick a specific object. The following code I've adapted works but works on any object. Any ideas on how I can make it specific to a particular object (model). Note: at the moment the code will hide and show the mouse.
--pick an object
if MouseHit(1)==1 then
if picked==0 then
pick=CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,2.0),0,0)
if pick~=nil then
repeat
if pick.entity:GetClass()==ENTITY_MODEL then
break
end
pick.entity=pick.entity.parent
until pick.entity==nil
if pick.entity~=nil then
ShowMouse()
picked=1
end
end
elseif picked==1 then
picked = 0
end
end--
--Update controller
controller:Update(camerayaw,move,strafe,jump,40,10)
fw:Update()
if picked == 1 then
HideMouse()
end