Shaping Physics: A Unity Asset Modification

In my last project before 'Danger Space' I modified a popular Unity asset - the aptly named Shapes, by Freya Holmér. This remarkable package enabled fast and versatile solutions for the visual aspects of virtually any prototyping task, featuring an array of renderable shapes like lines, circles, rectangles, and regular polygons. While Shapes brought rapidity and versatility to the table, it was missing something that would significantly amplify its usefulness to me - integration with Unity's built-in 2D physics. So, I set about bridging that gap.


The Need for Modification

The omission of any integration with Unity's physics system in the Shapes package, while not a deal-breaker for some, was a limitation that diminished the asset's value to me. I saw an opportunity to make it more dynamic, more versatile - and I seized it.


The Modification Process

I began the modification process by allowing all the different shapes in the package to spawn with a corresponding Collider2D when added to a scene. Rectangles would generate a BoxCollider2D, Circles a CircleCollider2D, and regular polygons a PolygonCollider2D. Moreover, these Collider2D components would dynamically update whenever a shape was altered to ensure the collider always conformed to the specific characteristics of the shape. For example, changing a polygon's number of sides would trigger the PolygonCollider2D to update and match the new polygon. I also included integration with Unity's Rigidbody2D system in my modification. With this addition, each shape now spawned with not only an appropriate Collider2D but also a Rigidbody2D.

I extended the Shapes package's editor for the base ShapeRenderer class, introducing custom toggles that permitted quick addition or removal of the Collider2D and Rigidbody2D. I also provided controls and toggles for other commonly used features, such as transforming the Collider2D into a trigger collider and a field for setting the PhysicsMaterial2D.


Impact and Significance

The resulting integration with Unity's 2D physics system transformed the Shapes package into a tool that facilitated rapid prototyping without concerns over visuals or physics components. No longer was it necessary to labor over adding physics components and configuring colliders for all visual elements. The ability to quickly iterate on ideas significantly reduced development time and paved the way for speedy project completion. This impact was confirmed throughout the development of my next project, Danger Space.

The modification of the Shapes package underscores the essence of resourcefulness in game development. Enhancing an existing tool allowed for more streamlined, efficient game prototyping. It now serves as another useful tool in my game developer’s toolkit, providing valuable benefits for the rapid ideation and creation of future projects.

Previous
Previous

Server Administration Tool for Halo Online

Next
Next

From Conception to Completion: The Evolution of ‘Danger Space’