jaipack17 / Nature2D

A 2D physics engine for Roblox. Create versatile physics simulations and mechanics with GUIs!
https://jaipack17.github.io/Nature2D/
MIT License
147 stars 8 forks source link

N-gon Custom Rigid Body Construction Plugin #36

Closed jaipack17 closed 2 years ago

jaipack17 commented 2 years ago

Description

Create a new plugin which makes it easier to create n-gons or in other words n-sided polygonal structures for custom rigid bodies. It is a very tedious task to create custom rigid bodies with more than 4 sides since (i) it is hard to determine which points you should join to create support constraints. (ii) Additionally, there exist plugins for making only quadrilaterals and triangular custom rigid bodies.

Example:

-- A pentagonal custom rigid body.
-- Plugins.ConstructRigidBodyStructure(a, b, c, ..., n)

local Pentagon = Engine:Create("RigidBody", {
    Structure = Plugins.ConstructRigidBodyStructure(
        Vector2.new(10, 10), Vector2.new(20, 20), Vector2.new(15, 30),
        Vector2.new(5, 30), Vector2.new(0, 20)
    ),
    Collidable = true,
    Anchored = false
})

A way this can be accomplished is to form support constraints of the rigid body using the Deulaunay Triangulation algorithm

Importance

This would be quite an important feature since it'll make it easier to create a vast variety of custom rigid bodies provided the positions of its vertices in clock-wise or anti-clock-wise arrangement.

github-actions[bot] commented 2 years ago

Looks like there hasn't been much activity going on here! In order to prevent clutter and purge inactive issues, this issue will be closed if it remains in the state of inactivity. If your issue has not been solved, you can open another issue to address your query! Be sure to format your issue correctly to help us review and process your issue faster!