Skip to content

Your First 3D App - Part A: Introduction

Let's build your first 3D app using the Ursina engine!


Learning Goals

When you finish this lesson, you'll be able to do the following:

  • Understand how to import the Ursina engine
  • Learn how to create a game window
  • Learn how to create a 3D cube
  • Learn how to use variables to store information

What do you make?

In this lesson, we'll build your first 3D app with the Ursina engine!

An Ursina game window showing a red 3D cube in the center of the screen

  • Creating an Ursina game window
  • Creating a red 3D cube
  • Managing properties with variables
  • Printing console messages

Run time: about 2 minutes Difficulty: (Beginner)


Take a look at the code

Below is the code that builds your first 3D app. Take a close look at it!

Folder: one_basics_and_setup / File: hello_ursina.py

hello_ursina.py
from ursina import *  # (1)

# Create the game window
app = Ursina()  # (2)

# Variables - store information
my_name = "Student"  # (3)
cube_size = 2  # (4)
cube_color = color.red  # (5)

# Print to console
print("Hello, Ursina!")  # (6)
print(f"My name is {my_name}")  # (7)

# Create a 3D cube
my_cube = Entity(  # (8)
    model='cube',
    color=cube_color,
    scale=cube_size
)

# Run the game
app.run()  # (9)
  1. Imports all of the features from the Ursina library. * means "everything."
  2. Creates a game window and app stores it in a variable. This is the basic frame of our game.
  3. Creates a variable that holds a string. It stores the name "Student."
  4. A number variable that determines the size of the cube. 2 means twice the default size.
  5. A variable that determines the color of the cube. color.red means the color red.
  6. Prints "Hello, Ursina!" to the console (terminal).
  7. Uses an f-string to print a message that includes the variable's value. {my_name} gets replaced with "Student."
  8. Entity() creates a 3D cube and sets its shape, color, and size.
  9. Runs the game window and displays it on the screen. Without this line, the window won't appear!

How to Run It (Required)

  • Move to terminal: cd .. after cd folder_name
  • Run: python filename.py (autocomplete with the Tab key)
  • Exit: Alt+F4 (Win) / Cmd+Q (Mac)

How to Control It

Most games use the standard control scheme:

  • WASD Or Arrow keys: move
  • Mouse: adjust view / aim
  • Left click: shoot / interact
  • Space: jump (platformer games)
  • Tab: toggle slow motion (slow_motion.py)
  • Escape: quit the game