Virtual reality with CoSpaces

By Andreas Dengel. Posted

A student trying out the CoSpaces virtual reality view

Originally published in Hello World Issue 19: Sustainability and Computing, June 2022. All information true at the time of original publishing.

Andreas Dengel shares his experiences of using the programming environment CoSpaces for introducing basic components of algorithms by designing three-dimensional virtual worlds

Numerous tools have already been developed to introduce programming and modelling at lower secondary. These range from text-based development environments such as Robot Karol, EOS, and Logo, to block-based development environments and physical computing tools such as Scratch, LEGO® MINDSTORMS®, and micro:bits. A key advantage of these tools is a motivating and age-appropriate approach to teaching programming to students. By successively working through simple building blocks in descriptive contexts of algorithms (for example, statements, sequences, conditions, and loops, and sometimes also variables), the cognitive foundation is laid for high-level languages.


Another environment that you can use to introduce programming to your students is the block-based development environment CoSpaces ( The key difference with CoSpaces is that it lets learners build their own 3D scenes, animate them with code, and then explore them in either virtual reality (VR) or augmented reality (AR).

Similar to game engines for professional game development, such as Unity, there is a 3D-editor mode in which you first design the scene itself, independently of the programming. Learners select 3D objects from a library (or upload their own images, videos, and sounds) before activating the ‘Use in CoBlocks’ button for any 3D object they want to program. You can select code blocks from various categories in code mode, analogous to other block-based languages. The categories include:

  • Transformations: Movement, scaling, and rotation of objects

  • Actions: Animation of objects, speech bubbles, display of quizzes, selection options, and text panels

  • Events: Simple, predefined conditions such as click and collision events, and keyboard input

  • Control: Loops, self-defined conditions, parallel execution of code blocks, and scene changes

  • Operators: Mathematical operations and random numbers

  • Items: Adding, grouping, and deleting objects

  • Data: Setting and changing variables

  • Functions: Creating your own functions

There are two difficulty modes in CoSpaces: beginner and advanced. In beginner mode, the scope of the categories is limited to simple blocks. Switch to advanced mode to include more complex blocks such as string concatenation, displaying videos, rounding, and list operations.

Learners can then test the programmed environment in play mode. In doing so, the view is switched back to the camera viewing angle previously defined in the editor. The camera can be set to be either static (you can only tilt), classically movable (‘walking’ using the keyboard), or freely movable (‘flying mode’ using the keyboard), or it can be panned around a defined area. When using the smartphone app, the VR setting can then be activated, leading to a split screen and enabling an immersive experience with mobile VR glasses. As no keyboard input is possible in the VR setting, the actions are defined by gaze direction and clicks on the smartphone screen.

CoSpaces provides an editor mode (left) for designing the virtual environment and a code mode (right) to bring the objects to life and create interaction

The potential of CoSpaces

You may be thinking, another development environment for programming entry? Block-based? Again? But there are three key areas that distinguish CoSpaces from other development tools: motivation and differentiation; novelty effect and presence experience; and event orientation.

Firstly, CoSpaces sets itself apart through 3D modelling in the virtual environments. Three-dimensional approaches have a motivating effect on learners. Through the combination of a library of 3D models with animations and the ability to upload your own models, it can serve almost every area of student interest. In particular, open tasks, such as programming an animal to complete tricks, can be implemented individually. For example, in one class I ran, the kids (aged ten to eleven) chose their own pets, ranging from cats to unicorns. These tasks are particularly suitable for differentiation, as higher-performing students can continue to work creatively by adding more models to their virtual environments. In the mentioned class, this led to more questions on how objects can interact with each other, as well as comments such as, “Just look at my penguin fighting this T-Rex!”

Secondly, the use of immersive media such as VR can be really engaging for learners, due to both the novelty of the technology and the ‘presence’ experience (the feeling of being in a place other than where you are) that is evoked. Even though the visuals are simple, many students report feelings of ‘being there’, such as one student’s exclamation, “I touched him! Oh my, I touched him!” when testing her lion. This immersive experience can make it easier for students to cognitively store and access their learnings at a later date.

Finally, a major advantage of CoSpaces is the embedding of predefined conditions, which are event-based. In classical didactic programming environments such as Scratch, conditions must be implemented in continuous loops for fast response times in event queries, such as mouse clicks or keyboard inputs. For this approach, however, the concept of repetition must be introduced before the conditions, which makes the introduction of conditions unnecessarily difficult. In CoSpaces, there are premade event blocks, such as If ... is clicked ..., which creates a very simple access to conditions, repetitions, and variables. Such an event orientation is also close to established tools of software development: for example, Unity and Unreal Engine work with event-oriented concepts by using C# or JavaScript.

The teaching experiences I’ve witnessed so far shed a positive light on CoSpaces, with students becoming engaged in programming without even noticing that they are learning about complex components of algorithms. With students’ own curiosity being the main driver for learning in this environment, CoSpaces is an ideal introduction to programming and can lay the foundation for the later learning of high-level languages

Classroom recommendations

  • Use a topic that is motivating for all students, such as programming pets

  • Start with a short creative session in which students are allowed to design their static environments, then start programming to make their environments interactive

  • Introduce every algorithmic component with increasing complexity — for example, single instructions, followed by sequences, repetitions, conditions, and variables (advanced)

  • For every component, show one specific example and demonstrate where to find the blocks, but let the students explore more possibilities by themselves afterwards


Free - UK only

If you’re a UK-based teacher, volunteer, librarian or something in between, we'll send each issue free to your door.



Just want to read the free PDF? Get each new issue delivered straight to your inbox. No fuss and no spam.


From £6

If you’re not a UK-based educator, you can buy print copies from our store.