How to make visible colliders of a 3d object in game?
Hi, I want to make visible collider lines in game. For example, i have a cube object and , i want to place it on other gameobject. If other object is empty, i mean placeable, cube's collider lines' color will be green, otherwise lines will be red. It's like in survival games, trying to place a cube on somewhere. Before you place it, there are green or red lines that tell you, you can or can't place this item or object
Please write me, i'm trying to find this system but i found a lot of different stuff
Answer by itsharshdeep · Dec 12, 2015 at 07:56 AM
Hello First of all I dont know the exact answer of this question but I'm just trying to answer this question
One Thing you can do is you have to take a 3D Fbx which has only border lines and middle middle should be empty then you can change the material color according to your need like when ever you need green color you can write like
gameObject.GetComponent<Renderer>().material.color = Color.red;
Collider of this gameObject should be triggered so that you can place the cube into this. Now in OnTriggeredEnter if your requirements are matching for this then color should be Green otherwise Red This is just a basic start up approach. There may be numerous thing which you have to consider while writing this logic