Skip to content

A 2D physics engine for Roblox. Create versatile physics simulations and mechanics with GUIs!

License

Notifications You must be signed in to change notification settings

jaipack17/Nature2D

Repository files navigation



version
devforum model documentation

About

Nature2D is a 2D physics library designed for and on Roblox. Ever wanted to create 2D games but step back because Roblox doesn't have a built-in 2D physics engine? Use Nature2D to create versatile and smooth simulations and mechanics for your 2D games with minimum effort. Nature2D primarily uses methods of Verlet Integration and Convex Hull collisions.

RigidBodies and constraints can potentially be made with almost all UI elements, from Frames to TextBoxes. Create almost anything you can imagine. From bouncy boxes to destructible structures, even character movement in no time. Here's a wrecking ball connected to an invisible constraint knocking a few boxes off of the blue platform.

Showcase

Find all my interactive demos here - https://www.roblox.com/games/9646145835/Physics-Demos-2D

Created something cool with Nature2D? Open an issue or a pull request if you wish to showcase it here!

Rotating Objects

Wrecking Ball

Constraints

Smooth Collisions

Double Pendulum

Inclined Plane

Slingshot

Box Stack

Getting Started

Using the CLI - You can clone the repository on your local device and start experimenting.

$ git clone https://github.com/jaipack17/Nature2D.git

Roblox Model - Nature2D is available on the Roblox asset store for free. You can get the model through the following link.

https://www.roblox.com/library/7625799164/Nature2D

Using .rbxm File - Head over to the Releases page on github, choose a version and download the [email protected] file from its assets. Now right click in Roblox Studio's explorer, click Insert From File and select the file.

Using wally - Use wally, a package manager for roblox to install Nature2D in your external code editor. This requires wally to be installed on your device. Then, add Nature2D to the dependencies listed in your wally.toml file.

[dependencies]
Nature2D = "jaipack17/[email protected]"

After that, Run wally install in the cli. Nature2D should be installed in your root directory. If you encounter any errors or problems installing Nature2D using wally, open an issue!

Require the library and start coding.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Nature2D = require(ReplicatedStorage.Nature2D)

local World = Instance.new("ScreenGui")
World.IgnoreGuiInset = true
World.Parent = game.Players.LocalPlayer.PlayerGui

local engine = Nature2D.init(World)

-- code

To get familiar with the library, you can go through the documentation. Documentation is available at https://jaipack17.github.io/Nature2D/.

Contribution

If you encounter bugs or would like to support this project by improving the code, adding new features or fixing bugs - Feel free to open issues and pull requests. Also read the contribution guide.