UNITY TUTORIAL | PROJECT | SPACE SHOOTER |9. Creating Hazards

UNITY TUTORIAL | PROJECT | SPACE SHOOTER |9. Creating Hazards

2
Adding Asteroid as Hazard

 

3
Adding “RigidBody” and “Capsule Collider”

 

4
adding a script to give Tumbling
5
setting tumbling speed with a public variable
6
RigidBody.AngularVelocity | Random.insideUnitSphere
ezgif.com-video-to-gif
tumbling Asteroid but with Angular Drag
7
setting Angular Drag to 0
ezgif.com-video-to-gif-2
Asteroid tumbling without Angular Drag
8
adding a script to make destruction
9
OntriggerEnter to detect any collision | Destroy()
  • Destroy(other) – only removing the collider
  • Destroy(other.gameObject) – removing only the gameObject with Collider “other”
ezgif.com-video-to-gif-3
Bug | something is triggering “Destroy()” function
10
Debug.Log (other.name)
ezgif.com-video-to-gif-4
Debugging 1 | finding the cause
11
Debugging 2 | finding the cause
12
Debugging 3 | Tagging “Boundary”
13
Debugging 4 | detecting any gameObject with a tag “Bounadry” | return
  • Return ends the execution of a function and hands the control back the function that called it (maybe Unity itself)
  •  Return ends OntriggerEnter Function and returns the control back to Unity’s Game Loop
  • As a result, if the object’s tag is “Boundary”, we will never reach or execute “Destroy” function
ezgif.com-video-to-gif-5
Debugging 6 | Solved
ezgif.com-video-to-gif-6
Asteroid destroyed by Laser

UNITY TUTORIAL | PROJECT | SPACE SHOOTER |6. Creating Shots

UNITY TUTORIAL | PROJECT | SPACE SHOOTER |6. Creating Shots

2
creating Empty GameObject & Quad for Shot
3
Texture for Laser
4
creating Empty Material to create Material for shot
5
creating Material
6
adding Material to “Mesh Renderer”
7
Mesh Renderer | Material | Shader
8
changing Shader for Laser | Particle – Additive
9
deleting collider for VFX
10
adding RigidBody & Capsule Collider to Shot | Trigger Collider
11
Creating Prefab
12
“Mover” Script for shot | RigidBody.Velocity | Start()
13
deleting instance of shot
ezgif.com-video-to-gif
creating instances of laser

UNITY TUTORIAL | PROJECT | SPACE SHOOTER |2. The Player Game Object

UNITY TUTORIAL | PROJECT | SPACE SHOOTER |2. The Player Game Object

2
Adding Player GameObject
3
Resetting the position of “Player” into (0, 0, 0)
4
Transform.Position set to (0, 0, 0)
56.png
RigidBody Added | Gravity Unactivated
6
Capsule Collider Added
ezgif.com-video-to-gif
Changing Collider Size
8
Changing the direction of Collider into Z-Axis for configuration
9
Changing the Radius and Height of Collider
10
Adding “Mesh Collider” | only one collider should be added
11
“Mesh Renderer” off to see “Mesh Collider”
13
Simplified “Mesh” added to “Mesh Collider”
14
“Particle” added as Child GameObject of  “Player”
ezgif.com-video-to-gif 복사본
“Particle” effect