Jump to content

camerapick


wildcherrii
 Share

Recommended Posts

Is

    local ent = (camera:Pick(p.x,p.y,pickinfo,pickradius, true, 0)) 

To expensive to call per frame ?  I notice a little lag spike when doing so, but how else can we detect when mouse is over an object?  I cant have the mousehit(1) checked then do a pick in my situation.

Link to comment
Share on other sites

  • 2 weeks later...

It is expensive per frame.  Usually like you say you would only call it when you click the mouse.  I've never done this - but you could cast the mouse position into a 3d position and then detect if a ray from that position going in the direction that the camera is facing would intersect the AABB of the objects in the scene.  It would involving looping through every object (you may find a way to reduce the amount you go through depending on what your trying to find) but I'm not sure how must faster it could be, if at all.

If your trying to detect a specific object you could add those objects too a list at start-up and do an AABB intersecting of that list only.  It won't be as accurate as a pick but it may point you in the direction you need.

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