Professional Documents
Culture Documents
Unit 1 3D Game Development
Unit 1 3D Game Development
Unit 1 3D Game Development
3D GAME DEVELOPMENT
INTRODUCTION TO HATCH XR
What is HatchXR?
HatchXR is a learning platform where you can design and develop your own game . It is real-world
Coding environment which allows user to create 3D games in AR and VR helping to build strong
foundation for STEM learning .
What is 3D?
3D, or three dimensional, refers to the three spatial dimensions of width, height and depth. The physical
world and everything that is observed in it are three dimensional.
3D Objects
Objects are called characters in 3d games which is very crucial in the designing process . We have come across
many games which have the main character , target character and obstacle character . The games that we will build
throughout this module will help us understand the importance of objects in game designing .
Environments
Environments are just like backgrounds of the games describing the details of the game like in Minecraft game
steve , trees , bushes can be the environment of the game which is particularly describing the overall design
requirement of the game.
Events
Event handlers can be used to handle and verify user input, user actions, and browser actions.
Cursor Events
Cursor Events means a trigger to do a task whenever the mouse moves over it or clicks on the
3D object. To Enable cursor events we have selected the 3D model and go to properties and
enable cursor events.
Exploring Hatch xr
Figure - 4
Part 2:
● Get ‘Wave Hello for 1 sec’ and ‘speak _ in accent with voice’ block from Minecraft Avatar.
● Change the text to ‘ Hello Everyone. I’m Steve.’ or with the text you want.(Refer to Figure-5)
● Connect both the blocks with ‘when space key pressed’ block.
Figure - 5
Part 2
● After adding the previous blocks, add the ‘ Elephant speak __ translate in_accent with_’ from the
Elephant tab.
● Add ‘Hello Steve. I am Ellie.’ and change the accent to Hindi.
● Add the ‘play sound __’ block from the Sounds section and keep the sound
as‘ElephantTrumpet’(Refer to Figure 6)
Figure 6
Part 1:
● In Code Mode, inside the Cursor tab, scroll down till the end to find the ‘When cursor OnEntered
Object __’ block.
● In the blank space of the cursor event block, add the Horse block like a puzzle piece.
● The horse block can be found as the first block in the horse tab.
Part 2:
● In code mode . Go to “Horse” option under “Scene Layers”
● Add ‘Hello, my name is Casey.’ and change the accent to Hindi with a female voice.
● Add the ‘play sound __’ block from the Sounds section and keep the sound as ‘horse_neigh’. (
Refer to Figure 7 )
Figure 7
1.1.8 - Making the Gorilla speak
Part 1:
● In Code Mode, inside the Cursor tab, scroll down till the end to find the ‘When cursor
OnEntered Object __’ block.
● In the blank space of the cursor event block, add the Gorilla block like a puzzle piece.
● The gorilla block can be found as the first block in the gorilla tab.
Part 2:
● After adding the previous blocks, add the “Gorilla speak __ translate in_accent with_”.
● Add ‘I am Kong.... King Kong’ and Change the accent to French with male voice.
● Add the ‘play sound __’ block from the Sounds section and keep the sound as ‘Chimpanzee’.
(Refer to Figure 8)
Figure 8
● Go to Design Mode
● Add 3D Objects
● Go to Text option
● Select the Font Design and type the name for your drone
● Run script to see the output ( Refer to Figure 9)
Figure 9
● Go to Design Mode
● Click on the Drone option underScene Layers, drag the Drone right and left to observe the increase
and decrease in X axis position on your right pane
● Repeat same along Z axis to move forwards and backwards
● Go to Code Mode
● Code on key press events to move the drone right, left up and down
Figure 10
Restoration to original position on play click
● Making the drone move along Y axis up and down by key press “W” and “S”
● Make drone rotate towards left “A”, towards right “D”
Go to Design Mode
● Click on the Drone option under Scene Layers, drag the Drone forward and backwards to observe
the increase and decrease in Z axis position on your right pane
● Code on key press events to move the drone forward and backward
● Z Axis position increases when drone moves forward, decreases when it moves backward
Go to Code Mode
● Use key press events from Events tab
● Make drone turn to left when “A” key is pressed
Go to Code Mode
● Use key press events from Events tab
● Make drone right to “D” key is pressed
Go to Code Mode
● Use key press events from Events tab
● When Space key is pressed
● Use Repeat and wait blocks to move drone up and down along Y Axis
● Use Repeat and wait blocks to move drone left and right along X Axis
Figure 11
Figure 12
Figure 14
Drone Movements-Rotate
Figure 15
Drone Dance
● Get ‘When key pressed’ block from events.
● Select key as ‘space’
● Select the block to make the drone move up
by changing Y position values.
● Get repeat and wait blocks from ‘control’.
(Refer to Figure 16)
Duplicate the blocks and make the drone move right
left by changing X position values.
Figure 16
1.3 - Titanic Game
The “if” part of the statement is the condition that needs to be met in order for the code inside the block to
be executed . If the condition is true , the code inside the “if” block is executed . if the
condition is false , the code inside the “else” block is executed .
This Box over here says that if this Statement is TRUE, monsters will
make funny faces.
This Box over here says that if the statement is FALSE, the
monster will make this angry face instead.
What is a Timer ?
A timer is a clock that controls the sequence of an event while counting in fixed intervals of time. It is used
for producing precise time delay. Secondly, it can be used to repeat or initiate an action after/at a known
period of time. This feature is very commonly used in several applications. An example could be setting up
an alarm which triggers at a point of time or after a period of time.
If a small ball hits a big wall, it might just bounce off the wall and keep moving.
But if two big cars crash into each other, they might get damaged or even stop moving altogether.
1.3.2 - Project Flow
Create the required Environment
Go to Design Mode
● Add Rain environment
● Add star system environment
● Add Particle system from the environment
● Choose fire type for Particle system
● Set the appropriate visibility for the particle system
Go to Code Mode
● Go to Events
● Use When Play clicked option
● Change X value
● Add timer to make the movement continuous
Collision Detection
● Use the detect collision block to sense the collision of ship with the iceberg
● Use the remove Timer block to stop the ship movement
● Start fire in the ship by turning on the emitter
Go to Design Mode
● Add Rain environment
● Add star system environment
Go to Code Mode
● Go to Events
● Use When Play clicked option
● Change X value
● Change the Y values for the ship negatively, to move the ship down means underwater
● Add timer to repeat the movement
● Use the rotation block to rotate the ship in terms of negative X-axis.
● Use timer to repeat the rotation
● Use remove timer block to stop the ship rotation after some time
● Just like ship, the Iceberg also need to be rotated before sinking
● Use remove timer to stop rotation after some time
● Change the Y values for the Iceberg negatively, to move it down means underwater
● Add timer to repeat the movement
● Go to the Design tab and click on the ‘+’ button and add the particle system from
the environment.
● Set the particle system as the child to the titanic
(drag and drop it inside the titanic 3D model tab).
● Choose the fire type particle system and appropriately place it on the ship
Observation: Go to the Design section and change x position of the Ship by positive
and negative value and see in which direction it is moving and then add the number
to the code block.
Figure 17
Observation: Go to Design, Check that there is another component added inside the ship and that is the
particle system and check that the particle type of it is ‘Fire’. As soon as the ship collides with the Iceberg,
we need to start the fire in the ship and for that we need to turn on the emitter. So, get the block from the
particle system.
Step 1: Since sinking means that the ship is going underwater, we need to change its Y-axis(Bottom)
negatively. (Refer to Figure 18)
Figure 18
Step 2:Adding a timer named ‘sink’ to repeat the change Y-axis block after every 0.05 seconds to let it
drown completely.( Refer to Figure 19)
Figure 19
Step 3: Add the timer to the collision code. ( Refer to Figure 20)
Figure 20
Step 1: This will help the ship to rotate in terms of X-axis negatively(from right to left) (Refer to Figure 21
Figure 21
Step 2: Adding a timer named ‘rotate’ to repeat the rotation block after every 0.05 seconds.
Figure 22
Step 3: Now we know that we need to stop rotating the ship once it is nearly facing upward. (almost 90
degrees.) So, Check a condition where if the x-axis rotation should always be less than or equal to 85
degrees only and once it crosses that value, it will remove the rotate timer and stop rotating.(Refer to
Figure 23)
Figure 23
ACTIVITY TIME
Create a game on Deadpool Dancing where deadpool is dancing on different dance forms
whenever the cursor is hovering over the different dance form text . Add the sound of your
choice and enhance the environment . Make use of concepts that are covered in the classroom
lessons .