Skip to content

About

Unity physics sandbox: a force/torque-driven rolling barrel with a dedicated convex collision mesh, plus the Blender source asset

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Barrel Animation — Unity Physics Sandbox

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.

Tech stack

  • Engine: Unity 2022.3.49f1 (LTS), built-in render pipeline
  • Language: C#
  • Source art: Blender (modelling, UV unwrap, albedo texture bake)

How it works

RollingObject (Assets/scr/NewBehaviourScript.cs) reads the Horizontal and Vertical input axes and drives the barrel through physics rather than transform manipulation:

  • AddForce applies translational movement in the input direction.
  • AddTorque applies 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 collision mesh

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.

Repository contents

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

Controls

Input Action
W / A / S / D or arrow keys Roll the barrel

Getting started

  1. Install Unity Hub and Unity 2022.3.49f1 (LTS).
  2. Clone the repo and open the project folder in Unity Hub.
  3. Open Assets/Scenes/SampleScene.unity and press Play.

No Git LFS required — all assets are plain Git.

License

Released under the MIT License — see LICENSE.

About

Unity physics sandbox: a force/torque-driven rolling barrel with a dedicated convex collision mesh, plus the Blender source asset

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages