Resources | ||
Source/UnrealFixedCollision | ||
.gitignore | ||
LICENSE | ||
README.md | ||
UnrealFixedCollision.uplugin |
UnrealFixedCollision
A collision detection library for Unreal Engine using fixed point math for coordinates and dimensions of collision shapes.
Please note: this library depends on the UnrealFixedMath library.
Please note: this is NOT a physics library. This library aims to only provide collision detection. Any collision resolution must be handled on a project by project basis.
This library aims to closely match the interface and functionality of the existing collision library in Unreal Engine. This library tries to closely match the available collision shapes available in Unreal (both 2D and 3D) as well as other functionality involved with collision (collision and trace channels, line/shape traces, etc.).
To-Do
- 2D Shapes
- Point
- Circle
- Box/Rectangle
- Line/Ray
- Arbitrary polygon
- 3D Shapes
- Point
- Sphere
- Capsule
- Box
- Line/Ray
- Arbitrary polygon
- Trace
- LineTrace/Raycast
- SphereCast
- BoxCast
- ShapeCast
- Collision channel support
- Trace channel support
- Broad phase collision detection using spatial partitioning
- Automatically get Unreal level/world/map collision data in a fixed point format
- Generate fixed point collision shapes during asset import
What is fixed point math?
Fixed point math is math that uses an INT data type format (i.e. int, long, long long) rather than a floating point format (i.e. float or double). Unlike normal integers, which represent entirely whole numbers, fixed point can represent fractional numbers. The way this works is a portion of the bits of the underlying data type are reserved for the fractional portion of the value, while the rest of the bits are reserved for the whole number portion.
For more detailed information on how this works see the Wikipedia article.
Why use fixed point over floating point?
In short, some projects require your game simulation to be fully deterministic, meaning given a set of inputs and an initial "world state" of your game, the resulting update will be the same each time.
Due to the nature of floating point numbers, calculations may result in slight differences between platforms or CPU architecture. This means your game simulation will not be fully deterministic. This can cause desyncs when implementing the lock-step or rollback networking models.
There are ways to get deterministic behavior for floating point operations between architectures with compilar flags, but this is not guaranteed or particularly easy. This also may not be feasible if you are using precompiled binaries, like would be the case when using the installed version of Unreal Engine. See this Gaffer On Games article for more information.
Setup
Clone this repository into the Plugins folder of your game project or your Unreal Engine installation.
Engine - /[UE Root]/Engine/Plugins/ Game - /[Project Root]/Plugins/
Usage
Coming soon...
Supported Unreal Engine Versions
- UE 5.1.1
Known Issues
None so far...
Licensing
This library is available under The MIT License. This library is free for commercial and non-commercial use. Attribution is not required, but is greatly appreciated.