wildcherrii Posted April 25, 2022 Share Posted April 25, 2022 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. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 6, 2022 Share Posted May 6, 2022 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. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 6, 2022 Share Posted May 6, 2022 Also, it would probably run a lot faster in a C++ project. And Release mode would be faster than Debug. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.