A 2D collision detection and physics library written in C.

Overview

c-krit/ferox

version badge code-size badge license badge

A 2D collision detection and physics library written in C.

WARNING: This library is in an early alpha stage, use it at your own risk.

DocumentationExamplesPrerequisites

Features

Bricks!

Since this project was made to learn how a physics engine works, I am not planning to add a lot of features to it.

  • Broad-phase collision detection with spatial hashing algorithm
  • Narrow-phase collision detection with SAT (Separating Axis Theorem)
  • 'Sequential Impulse' iterative constraint solver
  • Semi-implicit (symplectic) Euler integrator

Prerequisites

  • GCC version 9.4.0+
  • GNU Make version 4.1+
  • Git version 2.17.1+
$ sudo apt install build-essential git

Optional

Make sure you have installed raylib 3.7.0+ to compile all examples.

Building

This project uses GNU Make as the build system.

$ git clone https://github.com/c-krit/ferox
$ cd ferox
$ make

You can also build this library as standalone-mode to avoid raylib.h header inclusion and functions that depend on raylib:

$ make BUILD=STANDALONE

Cross-compiling for Windows

Make sure to set the value of RAYLIB_PATH variable to cross-compile for Windows:

$ make RAYLIB_PATH=../raylib TARGET_OS=WINDOWS

References

License

MIT License

You might also like...
JSFuck obfuscator written in ANSI C.

jsfuck.h JSFuck obfuscator written in ANSI C. For more info/context, visit www.jsfuck.com. Tested on MinGW (Windows) and GCC (Linux, Ubuntu). Build To

Whitee is a tiny compiler written in C++17, which translates SysY language into ARM-v7a assembly.
Whitee is a tiny compiler written in C++17, which translates SysY language into ARM-v7a assembly.

Whitee is a tiny compiler written in C++17, which translates SysY language into ARM-v7a assembly. Table of Contents Background Install Usage Ar

Another system information tool written in C++
Another system information tool written in C++

Sysfex Another neofetch-like system information fetching tool for linux-based systems written in C++. This is a hobby project, so bugs are to be expec

A little utility to look for updates on Gentoo written in C++
A little utility to look for updates on Gentoo written in C++

A little utility to look for updates on Gentoo written in C++

code (written in C) to check day by entering Date in DD/MM/YYYY format

Minimal Calendar Last Updated : Oct. 26, 2021 This code(written in C) can be used to know the day of the entered date in DD/MM/YYYY format. This c

A PE parser written as an exercise to study the PE file structure.

Description A PE parser written as an exercise to study the PE file structure. It parses the following parts of PE32 and PE32+ files: DOS Header Rich

A pong clone written in C++ with Raylib
A pong clone written in C++ with Raylib

How To Play Objective: first player to reach 10 points is the winner! PLAYER 1: W: up S: down PLAYER 2: ARROW UP or I: up ARROW DOWN or S: down Requir

Isocline is a pure C library that can be used as an alternative to the GNU readline library
Isocline is a pure C library that can be used as an alternative to the GNU readline library

Isocline: a portable readline alternative. Isocline is a pure C library that can be used as an alternative to the GNU readline library (latest release

A linux library to get the file path of the currently running shared library. Emulates use of Win32 GetModuleHandleEx/GetModuleFilename.

whereami A linux library to get the file path of the currently running shared library. Emulates use of Win32 GetModuleHandleEx/GetModuleFilename. usag

Comments
  • Fixed macro expansions inside 'broadphase.c'

    Fixed macro expansions inside 'broadphase.c'

    I fixed a couple macro expansions that were throwing errors inside MSVC, along with another error inside 'utils.h' related to the value of INVERSE_TWO_PI (ALL changes are properly discussed via comments inside the source files).

    enhancement 
    opened by Fallbork 1
Releases(v0.6.3)
  • v0.6.3(Oct 9, 2022)

  • v0.6.2(Aug 14, 2022)

  • v0.6.1(Aug 8, 2022)

  • v0.6.0(May 16, 2022)

    • Fixed a bug where Makefile would not show colored messages on MSYS2.
    • Fixed inefficient code in frQuerySpatialHash(). (https://github.com/c-krit/ferox/pull/9)
    • Renamed variables in collision module to keep the naming convention consistent.
    Source code(tar.gz)
    Source code(zip)
  • v0.5.6(Apr 10, 2022)

    • Fixed a problem where compile errors could occur due to macro expansions when using MSVC. (https://github.com/c-krit/ferox/pull/8)
    • Fixed inconsistent naming convention. (https://github.com/c-krit/ferox/issues/7)
    Source code(tar.gz)
    Source code(zip)
  • v0.5.5(Apr 3, 2022)

  • v0.5.4(Feb 20, 2022)

    • Fixed a bug where frCloneShape() would not copy is_rect property.
    • Fixed a bug where frComputeShapeRaycast() would not work properly against polygons.
    Source code(tar.gz)
    Source code(zip)
  • v0.5.3+1(Feb 18, 2022)

  • v0.5.2(Feb 15, 2022)

  • v0.5.1(Feb 12, 2022)

  • v0.5.0(Feb 11, 2022)

    • Added frVec2RotateTx() function.
    • Renamed fr_vec2.h to fr_math.h.
    • Optimized frVec2Transform() function.
    • Tweaked default values of FR_DYNAMICS_CORRECTION_DEPTH_SCALE and FR_DYNAMICS_CORRECTION_DEPTH_THRESHOLD in ferox.h.
    Source code(tar.gz)
    Source code(zip)
  • v0.4.2(Feb 10, 2022)

  • v0.4.1(Feb 6, 2022)

    • Added closest field to frRay struct, which allows the user to retrieve only the closest raycast hit.
    • Added frQueryWorldSpatialHash() function, which queries the world for rigid bodies that collide with the given Rectangle.
    • Fixed unexpected results for raycast functions in some situations.
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0+1(Feb 6, 2022)

    • Added bounds checks for frAddToSpatialHash() and frQuerySpatialHash().
    • Inlined all Vector2 operations, which significantly improves the simulation performance.
    • Reviewed several functions including frJarvisMarch(), frNormalizeAngle(), and frResolveCollision().
    • Updated the default value of FR_WORLD_MAX_BODY_COUNT to 192 (from 128).
    Source code(tar.gz)
    Source code(zip)
  • v0.3.6(Jan 29, 2022)

  • v0.3.5(Jan 26, 2022)

    • Added frComputeShapeCollision() and frComputeBodyCollision() functions.
    • Removed frComputeCollision() function.
    • Updated default broad-phase cell size to 3.0f.
    Source code(tar.gz)
    Source code(zip)
  • v0.3.4(Jan 23, 2022)

  • v0.3.3+1(Jan 19, 2022)

  • v0.3.2(Jan 18, 2022)

  • v0.3.1+1(Jan 17, 2022)

    • Added frCreateRectangle() and frIsInWorldBounds() functions.
    • Fixed TARGET_OS variable in Makefiles, which prevented the users from compiling this library properly with MSYS2 on Windows.
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Jan 10, 2022)

    • Added circles example.
    • Removed frEdge struct from collision module.
    • Optimized several functions in collision, dynamics, geometry, and utils modules.
    • Updated animations for the examples.
    • Updated external libraries. (stb_ds.h and sokol_time.h)
    Source code(tar.gz)
    Source code(zip)
  • v0.2.3(Jan 2, 2022)

    • Added new data types: frRay and frBodyFlag.
    • Replaced frComputeRaycast() function with frComputeBodyRaycast(), frComputeShapeRaycast() and frComputeWorldRaycast().
    • Updated jump example to use a collision pre-solve callback.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.2(Dec 28, 2021)

  • v0.2.1(Dec 25, 2021)

    • Added README.md in examples directory.
    • Fixed incorrect timestep code in frSimulateWorld().
    • Fixed return type of frSetBodyUserData().
    • Updated comments for vector math functions.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Nov 21, 2021)

    • Added new data types: frCollisionCallback and frCollisionHandler.
    • Added new functions: frGetBodyUserData(), frSetBodyUserData(), frGetWorldCollisionHandler(), and frSetWorldCollisionHandler().
    • Removed frReleaseWorldBodies() function.
    • Minor improvements for frComputeRaycast() function.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.3(Nov 10, 2021)

Owner
c-krit
模倣과 創作
c-krit
Hybrid Detect demonstrates CPU topology detection using multiple intrinsic and OS level APIs.

Hybrid Detect Hybrid Detect demonstrates CPU topology detection using multiple intrinsic and OS level APIs. First, we demonstrate usage of CPUID intri

null 38 Dec 23, 2022
Applications based on Wi-Fi CSI (Channel state information), such as indoor positioning, human detection

ESP-CSI The main purpose of this project is to show the use of ESP-WIFI-CSI. The human body detection algorithm is still being optimized. You can get

Espressif Systems 314 Jan 4, 2023
Security product hook detection

HookDump EDR function hook dumping Please refer to the Zeroperil blog post for more information https://zeroperil.co.uk/hookdump/ Building source In o

zeroperil 187 Dec 28, 2022
You Only Look Twice: Rapid Multi-Scale Object Detection In Satellite Imagery

YOLT You Only Look Twice: Rapid Multi-Scale Object Detection In Satellite Imagery As of 24 October 2018 YOLT has been superceded by SIMRDWN YOLT is an

CosmiQ Works 618 Dec 23, 2022
WhyNotWin11 - Detection Script to help identify why your PC isn't Windows 11 ready

Detection Script to help identify why your PC isn't Windows 11 ready

Robert C. Maehl 5.9k Dec 28, 2022
Windows kernel hacking framework, driver template, hypervisor and API written on C++

Windows kernel hacking framework, driver template, hypervisor and API written on C++

Александр 1.3k Jan 4, 2023
The most powerful and customizable binary pattern scanner written on modern C++

Sig The most powerful and customizable binary pattern scanner written on modern C++ ✔ Capabilities: Support for all common pattern formats: Pattern +

Александр 153 Dec 21, 2022
Tool based in nodes to build GLSL shaders without any programming knowledge written in C using OpenGL and GLFW.

FNode Tool based in nodes to build GLSL shaders without any programming knowledge written in C using OpenGL and GLFW (raylib library). It contains a c

Víctor Fisac 80 Dec 26, 2022
My CS:GO cheat, written with performance in mind.

sinclair_csgo My CS:GO cheat, written with performance in mind. Currently in development, and I plan to keep this as such!

Gabriel 25 Apr 9, 2022
A System Fetching Program written in C.

A System Fetching Program written in C.

ABHacker Official 7 Nov 24, 2022