Module 1: Introduction to Game Development
Module 2: Unity Interface and Basics
Module 3: Introduction to C# Programming for Unity
Module 4: Physics and Movement
Module 5: 2D Game Development
Module 6: 3D Game Development
Module 7: User Interfaces and Game Mechanics
Module 8: Animation and Visual Effects
Module 9: Sound Design and Implementation
Module 10: Building and Deploying Your Game
Module 11: Advanced Topics and Next Steps

6.3 Creating 3D Character Controllers

A functional and responsive character controller is key for player engagement.

Option 1: Using Unity’s Standard Assets

  1. Import Unity’s Standard Assets package via the Unity Asset Store.
  2. Add a pre-built FirstPersonController or ThirdPersonController to your scene.

Option 2: Building a Custom Character Controller

Step 1: Movement

  • Attach a CharacterController component to your player object.
  • Write a script for basic movement:
public float speed = 6f;
public float gravity = -9.8f;
private Vector3 velocity;

void Update() {
    float moveX = Input.GetAxis("Horizontal");
    float moveZ = Input.GetAxis("Vertical");

    Vector3 move = transform.right * moveX + transform.forward * moveZ;
    characterController.Move(move * speed * Time.deltaTime);

    velocity.y += gravity * Time.deltaTime;
    characterController.Move(velocity * Time.deltaTime);
}

Step 2: Jumping

  • Add ground detection logic using a raycast or collider check.
  • Modify the script to allow jumping when grounded.

Step 3: Animation Integration

  • Use Unity’s Animator Controller to blend movement animations seamlessly (Idle, Walk, Run).

Activity: Create a 3D character controller with movement, jumping, and basic animations.