- Home /
I have a GameObject which has children. One of those children has a large sphere collider (20 meter radius). That large sphere collider defines the range of the parent GameObject. If I want the player to see that range, what should I do?
The large sphere collider is on the IgnoreRaycast layer. This is so the player can still interact with the world, without colliders blocking up raycasts.
I was thinking of OnMouseEnter, add some texture to that collider, but since it is on IgnoreRaycast layer, that didn't work out.
Thanks!
why not just use distance between player and the object through checking their vector3() from each other.
The player plays through a non-movable camera. They have to be able to see the range of an object they select.
I can't see the relevancy of checking distances with displaying the border of the collider sphere on the selected object to the player.
create some kind of ring or some texture that you can instantiate when range is met. Some kind of visual indicator you create when the trigger is set.
Answer by MikeNewall · Feb 25, 2013 at 04:56 PM
It depends how you want to represent it in game? You could create a sphere or a cylinder that has no collider which is parented to the game object, and then set its radius to match that of the objects range. You'd need to make a semi transparent material and apply it to the sphere/cylinder so it doesn't obscure anything. If you want an animated effect you could make a shader for it.
To give you an idea of what I mean you could draw a sphere with OnDrawGizmos() as a test:
void OnDrawGizmos()
{
Gizmos.DrawWireSphere(objectPosition, radius);
}