Action with near object which one is better LOD vs raycast

Hi, I have no supervier in my workplace I think I ask alot in here

Anyway, The question is same as in title.

I’d like to make an action like show sprite near by object, which can interact object. Recently I’m using LOD for my code.

I think raycasting in every frame to every interactable object is very inefficient.
But also I think it is very unusual to use LOD to make some action when only near.

Is LOD is more efficient then raycasting to every object?
plus I’m using bvh so I think the raycast is fast enough.

From a strictly practical point of view (irrespective of any performance considerations) I would prefer to interact with nearby objects. Because they occupy more screen space, and are thus easier to hit (i.e.: harder to miss) with a mouse, and also provide higher resolution in the visual feedback of any such interaction.

LODs are not meant for simplifying interaction. Rather, they make it easier on the GPU for rendering, because few large triangles render faster than many tiny triangles covering the same screen space.

Lastly: if a raycaster finds an LOD or its current(!) representation depending on distance of camera should be irrelevant to you. Because you’ll want to interact with the object itself, not with its current representation within the LOD. But I think. others will be better able on clarifying that.

Are you aiming to display some label when the mouse is close to the object ?
If so, what shape are these objects.

nope not the mouse but the character

I’ll show you what I want :slight_smile:
when far


when near

Would distance[ Obj_1, Obj_2] < Obj_1.geometry.boundingSphere.radius + Obj_2.geometry.boundingSphere.radius
work?

You can get away with 100’s of these equations and NOT kill your FPS.

so you mean If I manually check the distance between obstacle and character it won’t affect framrate right?

Unless, you are doing 1000’s on low profile machine.
Here is a vid with collision detection using this concept.

Oh I got it! Thanks for your help! I think I’ll use that way! :slight_smile:

Keep in mind, BSR might not be best way to go, specially for objects that have high w/h ratio.
Anyway, if you ran into any problems, start a new thread.

Good luck.