Tool to help you visualize 2d physics colliders and joints. You can track their transform at runtime. Just add the proper component to GameObject with a Collider2D.
Warning: Objects with scaled parent can render incorrectly.
You can visualize colliders in two ways: rendering them as mesh and using editor gizmos. Frist method needs more steps to get result, second - is very simple but works only in Editor and need to attach different components for each type of Collider2D. Also, this package includes GUI tools to batch some operations with both types of visualizers.
New version supports visualizing through Collider2dRenderer which renders colliders shape to standard mesh. This type of visualization lacks most features of the gizmos-based visualizers but it works in standalone builds, can be batched in one draw call to minimize graphics overhead impact.
AlwaysUpdate- updates mesh every frameMeshColor- vertex color of the meshUseMaterialPropertyBlock- Set color by material property blockSetVertexColors- Set vertices colors withMeshColorvalueUseCircleProximity- use a custom number of segments created for circular areas of CircleCollider2D and CapsuleColldier2D. If not checked default value will be used (20). You can set the default value by accessing static variable Collider2dPointsGetter::CircleProximity.CustomCircleProximity- use a custom number of segmentsThickness- the thickness of shape in Unity points. If a camera is Orthogonal andUsePixelSizeis true it will be in pixel sizeUsePixelSize- to set mesh thickness in pixels
You can automate routine operations for you visualizers with the new manager which can be found at "Tools/Physics2dVisualizer/Open Manager" menu.
AnchoredJoint2DVisualizer- forDistanceJoint2D,FixedJoint2D,FrictionJoint2D,HingeJoint2D,SliderJoint2D,SpringJoint2D,WheelJoint2DBox2dVisualizerforBoxCollider2D(EdgeRadius not supported)Capsule2dVisualizerforCapsuleCollider2DCircle2dVisualizerforCircleCollider2DEdge2dVisualizerforEdgeCollider2DPolygon2dVisualizerforPolygonCollider2D(Multiple polygon Paths not supported)MovementLoggerfor tracking object's position and transform
- Don't forget to enable Gizmos visibility
IsVisibleEnables or disables rendering of collider.DynamicBoundsUpdates bounds of collider every time OnDrawGizmos calls. Useful when you changing Offset, Size, Radius, e.t. of the collider. If you don't just disable to increase performance.ColorColor of rendered collider.
BufferSizelimit number of records, set 0 if unlimitedRecordIntervallimit time of data storing, set 0 if you wat to do it every UpdateColorColor of visualizationRecordenable recordingDrawPointsenable visualizing of position pointsDrawLinesenable visualizing of pathRecordObjectStateRecords collider visualizer state, requires class inherited from BaseVisualizerRecordUnmovedrecord state even when the object wasn't movedDrawStateDraws collider visualizer state
This tools can help you to automate some routine operations without opening manager window.
Remove all visualizers- removes all gizmos visualizers found in the sceneAdd visualizers for all Colliders2d- automatically adds relevant gizmos visualizers for all Collider2D found in the sceneRemove all Collider2dRenderer- removes all Collider2DRenderer found in the sceneAdd the Collider2dRenderer for all Colliders2d- automatically adds Collider2Renderer visualizer for all Collider2D found in the sceneAdd default sprites material for all Colliders2d- sets shared material based on "Sprites/Default" shader for all Collider2Renderer found in the scene
The tool was written for Unity 2018. There are two ways to add it to a project.
Adding it via Unity Package Manager from a git URL requires Unity 2018.3 or newer.
Add the dependency to Packages/manifest.json of your project:
"artics.physics.unityphisicsvisualizers": "https://github.com/arhcy/Unity3d-physics-visualization-.git"Starting from Unity 2019.3 you can do the same from the editor: Window → Package Manager → + → Add package from git URL:
https://github.com/arhcy/Unity3d-physics-visualization-.git
Example scenes can be imported from Package Manager → Physics2d Visualizer → Samples (Unity 2019.1 or newer).
To pin a specific version, append a tag or commit hash to the URL, e.g. ...visualization-.git#<tag>.
In Unity versions older than 2018.3 the tool can still be used by simply copying the files: download the repository and copy its contents into any folder under Assets/ of your project (for example Assets/UnityPhisicsVisualizers). Folders ending with ~ (DevProject~, Samples~, Screenshots~) are ignored by Unity and are not needed; if you want the example scenes, copy Samples~/Examples as Assets/.../Examples without the ~.
The repository root is the package itself. To work on it, open DevProject~ in Unity (2019.1.15f1) — it references the package via file:../... Example scenes can be imported from Package Manager → Samples.




