A code example for a Rigid body suspended from a spring constraint!
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Nature2D = require(ReplicatedStorage.Nature2D)
local Engine = Nature2D.init(SomeScreenGuiInstance)
Engine:CreateCanvas(Vector2.new(0, 0), Vector2.new(1920, 1080), SomeCanvasFrame)
Engine:SetPhysicalProperty("AirFriction", 0.02)
local Anchor = Engine:Create("Point", {
Position = workspace.CurrentCamera.ViewportSize * Vector2.new(0.5, 0)
Snap = true
})
local Box = Engine:Create("RigidBody", {
Mass = 1,
Object = SomeGuiObject,
Collidable = true,
Anchored = false
})
local Spring = Engine:Create("Constraint", {
Type = "Spring",
Point1 = Anchor,
Point2 = Box:GetVertices()[1],
Visible = true
})
Engine:Start()