See the size of an overlap sphere
Is there a way to visibly see how large an overlap sphere is? As far as I can tell it given no indication of units for the radius given and since its an invisible physics object I can't really see how large it actually is. It keeps being to large and I can't tell how big it really is.
Answer by Thom Denick · Jan 20, 2012 at 10:00 PM
You can use the Gizmo DrawSphere to see the sphere in the Scene: http://unity3d.com/support/documentation/ScriptReference/Gizmos.DrawSphere.html
That needs to go in the OnDrawGizmos or OnDrawGizmosSelected methods.
private void OnDrawGizmosSelected() {
Gizmos.color = Color.red
//Use the same vars you use to draw your Overlap SPhere to draw your Wire Sphere.
Gizmos.DrawWireSphere (transform.position + m_Position, m_Radius);
}
If you want to see it in the Player, the easiest way would probably be to Instantiate a Sphere prefab at the exact same dimensions of your OverlapSphere. I do not think OverlapSphere has any kind of built in way of doing this.
Just to add to this you don't need to instantiate the sphere in the scene. You can just click the gizmos button at the top of the game window near maximise on play, mute audio and stats.
Instantiating a sphere with the same dimensions as your OverlapSphere doesn't work, the OverlapSphere is bigger.
Answer by IwishIcanFLighT · Dec 03, 2014 at 10:37 AM
For some reasons, I couldn't get OnDrawGizmosSelected()
to work. But OnDrawGizmos()
did the trick just fine !
You probably forgot to select your gameobject in the scene view.
Your answer
