This repo contains a series of physics, networking and AI exercises completed for CSC8503 at Newcastle University.
Category | Feature | Description | Version |
---|---|---|---|
Physics | Raycasting | Fires infinitely thin lines from a point in the world to see which objects collide with it. | |
Physics | Linear Motion | Uses a semi-implicit Euler integrator to simulate rigid body dynamics. | |
Physics | Angular Motion | Simulates angular movement dynamics using moments of inertia. | |
Physics | Collision Detection + Resolution | Sphere and AABB detection capabilities, with a plan to eventually implement OBB, capsule and swept volume collisions. | |
Physics | Broad & Narrow Phase | Octree Broad and Narrow spatial acceleration structure implementations. | |
AI | State Machines | Using a templated generic FSM. | |
AI | A* Pathfinding | Using Manhattan heuristic on grid-based paths. | |
Debug | Physics Volume Rendering | Displays physics volumes in the scene. |
- The implementation in this repo began as an exercise through Newcastle University Raycasting Tutorial.
- Mouse Picking using raycasting contains a complete derivation of the inverse of the projection matrix as a tool towards mouse picking.
- Layers are implemented as to allow for selective layer collision mechanisms.
The following image contains a snapshot of raycasting being used to highlight mouse selected gameobjects and those around them, with the cube object layer objects ignoring the sphere layer during raycasting:
- The implementation in this repo bagan as an exercise through Newcastle University Linear Motion Tutorial.
The following gif contains an example of movement using additive forces on selectable objects:
- The implementation in this repo bagan as an exercise through Newcastle University Angular Motion Tutorial.
- This is a list of moments of inertia, and was used to implement hollow spheres.
The following gif contains an example of angular movement using point specific additive forces on selectable objects:
- The implementation in this repo began as an exercise throughthe following tutorials: 1 and 2.
- Terminology:
- Coefficient of Restitution: The ratio of an object's velocity before and after a collision.
- Perfectly Elastic: Combinations of restitution coefficients of 2 materials = 1
- Inelastic: Combinations of restitution coefficients of 2 materials = 0
The following gif contains an example of collision resolution between AABBs and Spheres using Projection Seperation and Impulsing:
The following gif contains an example of collision resolution between AABBs and Spheres using the Penalty Method utilising Hook's Law:
Below is an example of AABB and Sphere physics volumes in debug render mode:
Key | Tag | Description |
---|---|---|
Escape | Exit | Terminates the program. |
Page_Up | Enable Console Window | Enables the console window. |
Page_Down | Disable Console Window | Hides the console window. |
DEBUGGING | ---- | The keybindings listed below are used to perform debugging on the simulation. |
Mouse 1 | Object Selection | If used over a gameobject on a raycastable layer, will trigger the Object Selection State on that object. |
P | Debug Render Toggle | Toggles rendering between the debug scene and the game scene. |
R | Camera Movement State Toggle | Toggles between free camera movement and no camera movement. |
L | Object Lock Camera Movement | If an object is selected, toggles between object locked camera space and free camera movement. |
SIMULATION | ---- | The keybindings listed below are used to alter the simulation settings. |
F1 | Reset | Resets the simulation world. |
F2 | Camera Reset | Resets the simulation camera to a pre-defined location in the world. |
F7 | Enable Object Shuffle | Enable object shuffling to reduce physics calculation bias. |
F8 | Disable Object Shuffle | Disable object shuffling. |
F9 | Enable Constraints Shuffle | Enable constraint shuffling to reduce physics calculation bias. |
F10 | Disable Constraints Shuffle | Disable constraint shuffling. |
G | Gravity Toggle | Toggles the gravity of the simulation between an active and non-active state. |
CAMERA | ---- | The keybindings listed below are only active when the camera movement state is active. |
W | Forward | Moves the camera in the forward direction. |
A | Left | Moves the camera in the left direction. |
S | Backwards | Moves the camera in the backwards direction. |
D | Right | Moves the camera in the right direction. |
Q | Up | Moves the camera in the upwards direction. |
E | Down | Moves the camera in the downwards direction. |
OBJECT SELECTION | ---- | The keybindings listed below are only active when the gameObject selection state is active. |
W | Forward | Moves the object in the forward direction. |
A | Left | Moves the object in the left direction. |
S | Backwards | Moves the object in the backwards direction. |
D | Right | Moves the object in the right direction. |
Q | Up | Moves the object in the upwards direction. |
E | Down | Moves the object in the downwards direction. |
I would like to thank Dr Rich Davison for his exciting and informative lectures and tutorial materials throughout my time at Newcastle University.
The framework used for this repository was created and provided by him, and he has given permission for it to be used as learning material.