Hi there, I am trying to reproduce the SphereCollider gizmo inside the scene view. I tried using Gizmos.DrawWireSphere but the sphere shape is not the same as the one used in the SphereCollider or PointLight components. I also tried using Handles.RadiusHandle and the shape is good but it doesn't take in account the depth and the occluders in the scene view. Any idea how to get the same result as the SphereCollider ? Thanks a lot.
Could you post your OnDrawGizmos code, and the collider settings? This might help to find a solution.
@Dev6_RC Thanks for the answer. Concerning the sphere collider, it's just the basic Unity sphere primitive with the renderer deactivated and a radius of 1.0. Nothing special concerning the Gizmos or Handles code but here they are. Code (CSharp): // Monobehaviour script void OnDrawGizmos() { Gizmos.DrawWireSphere(transform.position, 1.0f); } // Editor script private void OnSceneGUI() { Handles.RadiusHandle(Quaternion.identity, myobject.transform.position, 1.0f, false); }
Anybody ? Maybe someone from Unity can tell me how they are doing this. Seems that they only use the Handles for the control point but not for the sphere shape, but how do they get the circle always facing the camera and being affected by occluders.
Hey @MaT227 , sorry for my late reply but I tested your problem in an empty scene. Seems like the gizmo is exactly as the collider but the collider has a Circle around the edges of the gizmo. This circle billboards forwards the camera. You could look into this code and write your own Gizmo Logic (With billboard circle) example here: https://www.assetstore.unity3d.com/en/#!/content/11396 This should be exactly what you are looking for.
Thanks for the answer @Dev6_RC ! I thought about creating that billboard circle by hand and it's seems that's the best solution for the moment. Thanks for the link !
I am simply using the Gizmos code from the package you suggested https://www.assetstore.unity3d.com/en/#!/content/11396 to draw a circle always facing the camera forward direction