A small Unity project demonstrating a physics-driven rolling barrel: a Rigidbody game asset that the player drives with force and torque, paired with a custom low-poly collision mesh. Built as a focused exercise in the Blender → Unity game-asset pipeline and in Unity's rigidbody physics.
- Engine: Unity 2022.3.49f1 (LTS), built-in render pipeline
- Language: C#
- Source art: Blender (modelling, UV unwrap, albedo texture bake)
RollingObject (Assets/scr/NewBehaviourScript.cs) reads the Horizontal and
Vertical input axes and drives the barrel through physics rather than
transform manipulation:
AddForceapplies translational movement in the input direction.AddTorqueapplies rotation on the perpendicular axis, so the barrel visually rolls in the direction it travels instead of sliding.
Both moveSpeed and rotationSpeed are serialized fields, tunable in the
Inspector without recompiling.
The barrel ships as two meshes, which is the point of the exercise:
| Mesh | Role |
|---|---|
Barrel.fbx |
The render mesh — full detail, what the player sees |
Barrel_Collider.fbx |
A simplified convex hull used as the MeshCollider |
Using the render mesh directly as a collider is expensive and, because Unity requires convex mesh colliders for moving rigidbodies, unreliable. Authoring a dedicated low-poly collider is the standard fix and keeps the physics cheap and stable.
| Path | Description |
|---|---|
Assets/Meshes/ |
Barrel.fbx (render) and Barrel_Collider.fbx (physics) |
Assets/Textures/Barrel_Albedo.png |
Baked albedo texture |
Assets/Materials/Barrel_MAT.mat |
Barrel material |
Assets/Prefabs/Barrel.prefab |
Assembled prefab — mesh, collider, Rigidbody, script |
Assets/Scenes/SampleScene.unity |
Playable scene |
Assets/scr/NewBehaviourScript.cs |
The RollingObject controller |
Source/ |
Blender source file and the exported FBXs |
| Input | Action |
|---|---|
W / A / S / D or arrow keys |
Roll the barrel |
- Install Unity Hub and Unity 2022.3.49f1 (LTS).
- Clone the repo and open the project folder in Unity Hub.
- Open
Assets/Scenes/SampleScene.unityand press Play.
No Git LFS required — all assets are plain Git.
Released under the MIT License — see LICENSE.