Skip to content
AI & Software Engineering
AI & Software Engineering

Explore AI, AI Agents, software engineering, and the technologies shaping the future.

  • Home
  • AI & Agents
  • System Architecture
  • Project Management
  • Projects
  • Tutorials
  • Tech History
AI & Software Engineering

Explore AI, AI Agents, software engineering, and the technologies shaping the future.

Unity in Practice 0004 – Unity Rigidbody

WCSee, May 7, 2025May 17, 2025

Unity Rigidbody Introduction

In Unity, a Rigidbody is a component that enables an object to interact with the physics engine. It allows GameObjects to respond to gravity, forces, collisions, and other physical effects, making movement and interaction more realistic.

🔧 Key Features of Rigidbody:

FeatureDescription
MassControls how heavy the object is. Heavier objects need more force to move.
DragSlows down movement over time (like air resistance).
Angular DragSlows down rotational movement.
Use GravityDetermines whether the object is affected by gravity.
Is KinematicIf checked, the object is not affected by physics forces, but can still be moved via script.
InterpolateSmooths out movement when the object is moving fast or the frame rate is low.
Collision DetectionControls how collisions are detected (Discrete, Continuous, etc.).

Sample In Practice

Step 1: Create Two 2D Sprites

  • Ground: Right-click on “Main Camera” → 2D Object → Sprites → Square, then select it and change its color to yellow in the Inspector.
  • Ball: Right-click on “Main Camera” → 2D Object → Sprites → Circle, then change its color to green in the Inspector.

Click the Play button. You’ll notice that the ball remains static—it doesn’t move yet.

Step 2: Add Rigidbody2D to the Ball

Select the Ball object in the Hierarchy, then click Add Component in the Inspector. Search for and add the Rigidbody2D component.

Now, when you press the Play button, the ball will fall due to gravity. but it will not stop when the ball htis to the ground.

Step 3: Add Colliders for Collision Detection

  • Ground: Select the Ground object, click Add Component, and add a BoxCollider2D.
  • Ball: Select the Ball object, click Add Component, and add a CircleCollider2D.

Now press Play—the ball should fall and stop when it hits the ground, thanks to the colliders and Rigidbody2D working together.

❓ Why Doesn’t the Ball Bounce When It Hits the Ground?

By default, Unity’s Rigidbody2D and Collider2D components do not produce bounce effects. Bouncing (or rebound) depends on the object’s Physics Material 2D settings.


✅ To Make the Ball Bounce, Follow These Steps:

Step 1: Create a Physics Material 2D

  1. In the Project panel, right-click → Create → 2D → Physics Material 2D
  2. Name it BouncyMaterial
  3. In the Inspector, set the properties:
    • Friction: 0
    • Bounciness: 1 (you can also try values between 0.8 and 1.0)

Step 2: Apply the Material to the Ball’s Collider

  1. Select the Ball object
  2. Locate the CircleCollider2D component
  3. Drag the BouncyMaterial to its Material field

🔁 Run the Game

Now, when you press Play, the ball should bounce when it hits the ground.

Please follow and like us:
RSS
Facebook
Facebook
fb-share-icon
X (Twitter)
Visit Us
Follow Me
Tweet
Pinterest
Pinterest
fb-share-icon
Post Views: 329

Related posts:

Unity in Practice 0013 – Physical Material 2D Introduction Unity in Practice 0007 – Very First Unity C# Code to Move and Jump a 2D Ball Unity in Practice 0011 – Player Jump with Ground Check in Unity Unity in Practice 0009 – How to Use Sprite Sheets in Unity for 2D Animation and UI Unity Game Development – Systematic Learning Roadmap (2025 Edition) Unity in Practice 0012 – Blend Tree in Unity Unity in Practice 0014 – Unity 2D Dash and Dash Cooldown with Time.deltaTime Unity in Practice 0008 – Encapsulation and Inspector Access with Unity’s [SerializeField]
Tech Notes BoxColliderCircleColliderRigibodyUnity Rigidbody

Post navigation

Previous post
Next post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Chapter 5 — Major AI Agent Architecture Patterns
  • Chapter 4 — What Is an Agent Harness?
  • Chapter 3 — The Agent Loop: The Core Execution Cycle of an AI Agent
  • AI Agent Architecture and Engineering Practice Guide
  • Chapter 2 — LLM Application Architecture: Core Components and Engineering Foundations
  • Chapter 1: Rethinking AI Agents
  • The Key Milestones in the History of Artificial Intelligence (2026.08)
  • Building a Python-based AI Agent with LangGraph and OpenRouter: A Hands-On Guide
  • System Architecture Design: What Is It Really “Designing”? Understanding Through a Building Analogy
  • When Data Exceeds Memory: Choosing Between Pandas, Dask, and DuckDB for Efficient Analytics

Recent Comments

  • WCSee on Chapter 1: Rethinking AI Agents
  • WCSee on Chapter 2 — LLM Application Architecture: Core Components and Engineering Foundations
  • WCSee on AI Agent Architecture and Engineering Practice Guide
©2026 AI & Software Engineering | WordPress Theme by SuperbThemes
Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}