0
\$\begingroup\$

Is there any method for mouse or ray to detect object doesn't have collider ? If no, what also can I use ?

\$\endgroup\$
  • 1
    \$\begingroup\$ Yes. You can compare the on-screen shape of the object against the position of the cursor. How to do that will depend on what kind of object you're trying to click. Please edit your question to include a representative example of the kind of object & detection you want to use. Be sure to include details like whether this object can be occluded by other objects in your scene. It can also be useful to describe why you're choosing not to use a collider — if you're worried about performance, it's better to demonstrate the performance issue in your profiling and ask how to solve that. \$\endgroup\$ – DMGregory Dec 28 '19 at 16:34
  • \$\begingroup\$ Thank you for your respond. Actually, I was using mesh collider and did what I need. But I now i'm afraid for the performance. What I'm trying to do is to map area for player on terrain. Like Tower Defense games. Small area for player the rest for enemy. Because the terrain have hills and different shapes of ground. I have to make a 3d panel above the terrain as a player movement area. Later, I will use in one terrain three maps for player. This will effect the performance. So, what you think use this or try your method ? \$\endgroup\$ – user43474 Dec 28 '19 at 17:19
  • 1
    \$\begingroup\$ For something like mesh terrain, you will have to do all the same work to find the intersection point in your own math that the physics engine does with a collider, but I'd be willing to bet that your code will run slower than the highly-optimized physics engine's solution. So just use a collider. If you find it causes a noticeable slowdown in some situation, post here detailing the specific setup you've used and the results you're seeing in the profiler, and we can help you optimize the trouble spots. \$\endgroup\$ – DMGregory Dec 28 '19 at 17:33
  • \$\begingroup\$ OK. Thank you for the information. I hope all will run fine. \$\endgroup\$ – user43474 Dec 28 '19 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.