- Home /
How do I render a collider?
So what I am trying to do, is be able to visualize my collision data. I have an animated model, and have colliders in my scene, and I want to be able to SEE the actual colliders to debug collision problems in my game. It would be even better if I could assign different materials to different types of collision shapes in my game. I understand the conventional way to render in unity is with a renderer. Is there no debug drawing functionality to visualize collision boundaries? Most physics engines have debug drawing capabilities. Heres an example of the functionality I would like to achieve within unity: http://images.search.yahoo.com/images/view;_ylt=A2KJkPoMsQpS_EAARUOJzbkF;_ylu=X3oDMTFxZHE5cHIzBHNlYwNzcgRzbGsDaW1nBG9pZAM1Zjk5ZDA0MDlkZGQxYTRlZTUzYjhkMmQ4N2YyMTFmMARncG9zAzE-?back=http%3A%2F%2Fimages.search.yahoo.com%2Fsearch%2Fimages%3Fp%3Ddebug%2Bdraw%2Bogre%2B3d%26n%3D30%26ei%3Dutf-8%26y%3DSearch%26fr%3Dchr-greentree_gc%26tab%3Dorganic%26ri%3D1&w=300&h=234&imgurl=www.ogre3d.org%2Ftikiwiki%2Ftiki-download_file.php%3FfileId%3D2055%26amp%3Bdisplay%26amp%3Bx%3D300%26amp%3By%3D234&rurl=http%3A%2F%2Fwww.ogre3d.org%2Ftikiwiki%2FDebug%2BDrawing%2BUtility%2BClass&size=30.8KB&name=%3Cb%3EDebug+%3C%2Fb%3EDrawing+Utility+Class&p=debug+draw+ogre+3d&oid=5f99d0409ddd1a4ee53b8d2d87f211f0&fr2=&fr=chr-greentree_gc&tt=%3Cb%3EDebug+%3C%2Fb%3EDrawing+Utility+Class&b=0∋=96&no=1&ts=&tab=organic&sigr=11qs8mjkk&sigb=13tvs1u30&sigi=12q9bidvj&.crumb=UwFcCtv0tGc&fr=chr-greentree_gc
They of course are using Ogre3D, but being able to visualize the collision shapes would make things much easier for me.
When you ask a question, take the time to explain clearly what you want, and why. This can really help us along to get you where you want... And tag your questions correctly, with relevant keywords , or at least those that have an obvious relation to your question.
What a mess. PLEASE learn how to use and post questions, comments, and answers here.
Answer by HolBol · Aug 13, 2013 at 10:01 PM
You can't. Colliders, and renderers are different things. What you could do is use the same mesh for the collision as the rendering, but as I see you're using the SkinnedMeshRenderer, then you need to do collision as a separate object.
Answer by YoungDeveloper · Aug 13, 2013 at 10:36 PM
You can attach a mesh collider to any mesh and it will create a collider in that same shape. And at the start disable that objects mesh renderer, so you wont be able to see the object but actually collide with it. And On collision or trigger you could enable the renderer back on. So it will look like if you collide with it you will see it.
Good luck.
Answer by DaveA · Aug 13, 2013 at 11:00 PM
You can use Debug.DrawLine if you want it just in the editor scene view. Otherwise use a LineRenderer, GL, or Vectrosity would be my suggestion, and interpret the type of collider you have and its parameters to know how to code the drawing of it. But note that colliders are rendered as green wire frames in the editor scene.
Answer by MrCowKing · Jun 27, 2014 at 01:02 AM
Have a look at my plug-in: https://www.assetstore.unity3d.com/en/#!/content/18120
It can draw any type of collider that you want and more.
Your answer
Follow this Question
Related Questions
Combining Skinned Meshes 3 Answers
Skin modifier 3Ds Max Problems 2 Answers
Changing two different objects renderer colour 1 Answer
Android performance problem on model joints(Rig). 1 Answer
Mesh renderer properties 1 Answer