o
odinpkg.dev
packages / binding / joltc-odin

joltc-odin

84ab78cbinding

Odin binding for Jolt Physics using JoltC

No license · updated 4 weeks ago

joltc-odin

See odin-joltc as well

Jolt Physics bindings for Odin via joltc.

Overview

This project provides Odin language bindings for the Jolt Physics engine, enabling high-performance physics simulation in Odin applications. The bindings are automatically generated using odin-c-bindgen from the joltc C API.

Requirements

Note: The build here use just to run. It is not required and just a simple way to run script. Please see the justfile and execute the commands (for your os) if you prefer that.

Quick Start

Before executing any command, ensure the dependencies are downloaded:
git submodule init
git submodule update --init --recursive

1. Build JoltC Shared Library

To build only the shared library (.so on Linux, .dll on Windows, .dylib on macOS):

just build-joltc

Windows TODO

2. Generate Bindings (Optional)

If you need fresh bindings from the latest JoltC changes:

just build-bindgen
just gen-bindings

This will:

  • Download and compile odin-c-bindgen
  • Generate new Odin bindings from the C headers

Usage

In Your Project

  1. Copy the jolt directory to your project root
  2. Include the appropriate shared library for your platform:
    • Linux: libjoltc.so (place in /usr/local/lib to make it available to the system)
    • Windows: joltc.dll
    • macOS: libjoltc.dylib
  3. Import and initialize Jolt in your code:
package my_game

import jph "jolt"

main :: proc() {
    // Initialize Jolt Physics
    assert(jph.Init())
    defer jph.Shutdown()

    // Setup physics world, job system, etc.
    // See samples for complete examples
}

Running Tests

odin test jolt

Examples

Run examples with odin run examples/ballpit -debug

Project Structure

joltc-odin/
├── jolt/           # Generated Odin bindings
├── build.py        # Build script
└── README.md       # This file

Troubleshooting

Linking Issues

Make sure the shared library is:

  • In the same directory as your executable, or
  • In your system's library path, or
  • Properly referenced in your build configuration

You may need to adjust library paths in the joltc-odin package if your setup differs from the default.

Build Issues

Ensure all requirements are installed and accessible in your PATH:

  • Odin compiler
  • Python 3
  • libclang development headers

Acknowledgements

This project builds upon the excellent work of:

  • Jolt Physics - The high-performance physics engine (MIT License)
  • joltc - C bindings for Jolt Physics (MIT License)
  • odin-c-bindgen - Automatic binding generator for Odin (MIT License)

License

Please refer to the individual projects for their respective licenses.