Skip to content
/ curve Public

A Roblox library to help create and manage analytically defined curves in 3D

License

Notifications You must be signed in to change notification settings

ddavness/curve

Repository files navigation

Curve Library

A Roblox library that provides utilities to create and manage 3D curves (may also consider having 2D curves in the future).

Curves are created from certain key variables (start point, control point(s), etc.) and stored as [0, 1] -> CFrame functions. May be used for any purpose, including for example camera animations or procedural race track creation.

The library should be mostly unopinionated but it tends to be somewhat biased towards curves "based" on the XZ (horizontal) plane.

Since this library does not interact with the DataModel, it may be ported to another Luau platform (outside Roblox) if alternative Vector3 and CFrame implementations are provided.

Curve Type Support/Roadmap

:locationAt() :dt1() (Velocity) :dt2() (Acceleration) :lengthAt()
Lerp (line) 🚧 🚧 🚧
Bézier (Quad)
Bézier (Cubic)
Bézier (nth degree) Evaluating
Bézier chain/spline Evaluating
Hermite Spline Evaluating
Circular Arc 🚧 🚧 🚧
Euler Spiral (1) 🚧 🚧 🚧
Archimedian Spiral Evaluating

Legend

  • ✅ Implemented
  • 🚧 Not yet implemented, will be implemented in the future
  • ❌ Will not implement (not solvable analytically or not feasible to compute)

Notes

  • (1) Analytical solution involves Fresnel Integrals which do not have a closed-form solution, but can be expressed via a Taylor Series expansion (more info); implemented via approximations of that expansion over a finite amount of terms

Quick Start

Wally

Add this line to your wally.toml file:

curve = "ddavness/[email protected]"

Via rbxm

See the Releases page

On the Creator Hub

Take it from here!

Documentation

Soon™️, but you can see the dev folder for examples

Implementation Details

The library by default creates curves that go "forward" (they use CFrame.lookVector as reference), but assumes that the Roblox coordinate system is in place:

  • CFrame.rightVector is (1, 0, 0)
  • CFrame.upVector is (0, 1, 0)
  • CFrame.lookVector is (0, 0, -1)

Additional work may have to be done if you're using a different coordinate system.

⚠️ This is pre-1.0.0 software

Right now, while we think the actual curve implementations are solid (and perhaps good enough for production), the API interface is a bit "raw" and may need some polishing. Therefore, it is expected that breaking changes are introduced in the future.

The results of the curve are dependent on the implementation, too. If there is any significant change to the implementation of a curve, it's possible it can create a breaking change, too (this is not expected to, but might happen).

About

A Roblox library to help create and manage analytically defined curves in 3D

Resources

License

Stars

Watchers

Forks

Languages