SlideShare a Scribd company logo
Building your first game in Unity 3d  by Sarah Sexton
Introduction
Sarah Sexton
Technical Evangelist
Twitter: @Saelia
Microsoft, Chicago, IL
http://aka.ms/sarahsexton
www.SheBuildsGames.com
sarahse@microsoft.com
Phase One: Environment
Customizing your Workspace
1. Setup Editor Layout 2 by 3
2. Drag Project tab below the Hierarchy
3. Set view slider to minimum on Project panel
File > New Scene
File > Save Scene As,
name it Nightmares 01
in Scenes folder
Customizing your Workspace
Environment
1. Locate Environment Prefabs in the Project panel Prefabs folder
2. Drag into Scene or Hierarchy
3. Ensure it is at Position (0,0,0) in Transform
4. Repeat 1-3 for the Lights prefabs
5. Save your Scene (Ctrl+S)
(Nightmares 02)
Environment
1. GameObject menu > 3D Object > Quad
2. Rename to Floor
3. Ensure it is at Position (0,0,0) in Transform
4. Set Rotation (90, 0 0) in Transform
5. Set Scale to (100, 100, 1) in Transform
Environment
1. Remove Mesh Renderer Component
from the Floor game object
2. Set the Floor game object to use the
Floor layer at the top of the Inspector panel
3. Save your Scene (Ctrl+S) (Nightmares 03)
Environment
1. GameObject > Create Empty
2. Rename GameObject to
BackgroundMusic
3. Add Component > Audio > Audio
Source
1. Audio Clip >
Circle Select >
Background
Music
2. Check Loop
and set
Volume to 0.1
3. Save your
Scene (Ctrl+S)
(Nightmares 04)
Circle Select
Building your first game in Unity 3d  by Sarah Sexton
Phase Two: Player Character
Player Character
1. Locate the Player model in
Models > Characters folder of
the Project panel
2. Drag it into the Scene or
Hierarchy panels
3. Set the Position to (0,0,0) in
Transform
4. Set the Tag to Player in the
drop-down in Inspector
Player Character
1. Select the Animation folder and
click Create on the Project panel,
choose Animator Controller
2. Name this new asset PlayerAC
3. Drag and drop it onto the Player
in the Hierarchy
1. Double-click PlayerAC
asset in Project >
Animation
2. Dock the Animator
window by the Scene
view
Player Character
1. Expand the Player model in
Models > Characters
2. Drag the Idle, Move and Death
animations to empty space in the
Animator window to create states.
3. Right-click Idle state and choose
Set as Default
4. Create a bool parameter named
IsWalking
5. Create a Trigger parameter
named Death
Player Character
1. Right-click Idle and Make Transition to Move
2. Select the Transition arrow you made
3. Set the Condition for this to IsWalking = true
4. Right-click Move and Make Transition to Idle
5. Set the Condition for this to IsWalking = false
6. Right-click ‘Any State’ and Make Transition to Death
Building your first game in Unity 3d  by Sarah Sexton
Player Character
1. Set Condition for this to Death (trigger) 2. Select Player game object, Add Component > Physics > Rigidbody
3. Set Drag & Angular Drag to Infinity 4. Expand the Constraints, Freeze the Y Position, and Freeze the X
and Z Rotations
Player Character
1. Select Player game object, Add Component > Physics >
Capsule Collider
2. Set Center to (0.2, 0.6, 0)
3. Set Height to 1.2
Player Character
1. Add Component > Audio > Audio Source
2. Audio Clip > Circle select Player Hurt
3. Uncheck Play On Awake
4. Locate PlayerMovement script in Scripts >
Player
5. Drag & Drop this to Player game object in
Hierarchy
6. Save your Scene (Ctrl+S) (Nightmare 05)
Player Character
1. Double-click the icon of the PlayerMovement script to open it
in the Script editor.
Building your first game in Unity 3d  by Sarah Sexton
Player Character: Move, Normalization
Player Character – Raycasting, Quaternions
Building your first game in Unity 3d  by Sarah Sexton
Player Character
1. File > Save your script and return to the Unity editor
2. Press Play at the top of the interface to try out your game!
3. Stop Play (do not use Pause.)
DEMO
Building your first game in Unity 3d  by Sarah Sexton
Phase Three: Camera Setup
1. Select the Main Camera in Hierarchy
2. Set the Transform Position to (1, 15, -22)
3. Set the Transform Rotation to (30, 0, 0)
4. In the Camera component set the Projection to Orthographic
mode
5. Set the Size value 4.5
Camera Setup
1. Set Background Color to Black
2. Save your Scene (Ctrl+S)
3. Select the Camera folder in the Scripts folder of the Project
panel
4. Click Create > C# Script on Project panel
5. Name the script CameraFollow
Camera Setup
1. Drag and drop the CameraFollow script onto the Main Camera
in Hierarchy
2. Save your scene now!
3. Click Open at the top of the Inspector or double-click the
script’s icon to open it for editing
Camera Setup
Camera Setup
Camera Setup
Camera Setup
1. Save your Script, and return to Unity
2. Select the MainCamera and assignment Player from the
Hierarchy to the Target variable on CameraFollow
3. Save your Player as a Prefab by dragging the Player
game object from Hierarchy to the Prefabs folder in the
Project. Save, and press Play to test!
Building your first game in Unity 3d  by Sarah Sexton
Building your first game in Unity 3d  by Sarah Sexton

More Related Content

PDF
Sln skill cards
Barbara M. King
 
PPTX
Scratch Pong Remix Tutorial
jwmcdonald24
 
PPTX
Pong on SCRATCH Directions
vkmitchell
 
PDF
Run and jump tutorial (part 1) actors
Muhd Basheer
 
PPTX
Pong on SCRATCH Directions
vkmitchell
 
PDF
Star logo nova code cookbook
Barbara M. King
 
PPTX
Game maker walkthrough
LewisB2013
 
PDF
CETS 2013, Kate Leifheit, handout for Building a Flash Card Interaction with ...
Chicago eLearning & Technology Showcase
 
Sln skill cards
Barbara M. King
 
Scratch Pong Remix Tutorial
jwmcdonald24
 
Pong on SCRATCH Directions
vkmitchell
 
Run and jump tutorial (part 1) actors
Muhd Basheer
 
Pong on SCRATCH Directions
vkmitchell
 
Star logo nova code cookbook
Barbara M. King
 
Game maker walkthrough
LewisB2013
 
CETS 2013, Kate Leifheit, handout for Building a Flash Card Interaction with ...
Chicago eLearning & Technology Showcase
 

What's hot (16)

DOC
4. catch the ball
Marc Jones
 
PDF
Ac fr ogbzlj0hfgtuukn7qgwbjin09jlfvybtul26nfmcsos0gwpnx_im_kpn1bvazhycx3m6xcq...
dendipermadi
 
PDF
Instructions for Scratch Pong Game Adaptation to use with MaKey MaKey
Renee Neumeier
 
PDF
Maya
senthil4seo
 
PDF
Flash Tutorial
senthil4seo
 
PPTX
What’s new to power point
savannah_stevenson
 
PDF
120 tips about_photoshop
Galmher
 
PDF
waagen-ecard
tutorialsruby
 
PPTX
Windows 7 tips tricks
chenley
 
DOCX
Cheat rise of nation
Jimmy Deanz
 
PPTX
Galactic Wars XNA Game
Sohil Gupta
 
PPT
Edtech PP.
rnoval1030
 
PDF
Typest
MYAMADA
 
PPTX
Windows 7 Tips And Tricks
skendall1
 
PPTX
Petrel F 3 seismic intersections and data manipulation 2018 v1.1
Sigve Hamilton Aspelund
 
4. catch the ball
Marc Jones
 
Ac fr ogbzlj0hfgtuukn7qgwbjin09jlfvybtul26nfmcsos0gwpnx_im_kpn1bvazhycx3m6xcq...
dendipermadi
 
Instructions for Scratch Pong Game Adaptation to use with MaKey MaKey
Renee Neumeier
 
Flash Tutorial
senthil4seo
 
What’s new to power point
savannah_stevenson
 
120 tips about_photoshop
Galmher
 
waagen-ecard
tutorialsruby
 
Windows 7 tips tricks
chenley
 
Cheat rise of nation
Jimmy Deanz
 
Galactic Wars XNA Game
Sohil Gupta
 
Edtech PP.
rnoval1030
 
Typest
MYAMADA
 
Windows 7 Tips And Tricks
skendall1
 
Petrel F 3 seismic intersections and data manipulation 2018 v1.1
Sigve Hamilton Aspelund
 
Ad

Similar to Building your first game in Unity 3d by Sarah Sexton (20)

DOCX
Joshua meyer 2D Game workflow document
JoshCollege
 
DOCX
Work flow
soulsama
 
PDF
Unity 101
Hibby Games
 
PDF
PlayMaker入門 (Version 1.7.8)
Yuichi Ishii
 
PDF
How tomakea gameinunity3d
Dao Tung
 
ODT
Ben Atherton 2D Side Scrolling Shooter Workflow
Ben_Atherton
 
PPTX
Unity workshop
fsxflyer789Productio
 
PDF
Laser Defender Game in Unity3D
CompleteUnityDeveloper
 
DOCX
Work flow the pain is reel
Shaz Riches
 
DOCX
Work flow
Shaz Riches
 
PPTX
2D Top-down shooter workflow
raimondklavins
 
PPTX
Construct 2 Platformer: Step by Step
Shahed Chowdhuri
 
DOCX
Work Flow
Kalen612
 
PDF
2 d gameplaytutorial
unityshare
 
DOCX
Jake Hyatt 2D Game Workflow
Jakeyhyatt123
 
DOCX
Work Flow
Kalen612
 
PDF
Unreal Engine Basics 02 - Unreal Editor
Nick Pruehs
 
DOCX
2d game engine workflow
luisfvazquez1
 
PDF
Creating A Character in Uncharted: Drake's Fortune
Naughty Dog
 
PPTX
Fmp production reflection part 1
sean cawood
 
Joshua meyer 2D Game workflow document
JoshCollege
 
Work flow
soulsama
 
Unity 101
Hibby Games
 
PlayMaker入門 (Version 1.7.8)
Yuichi Ishii
 
How tomakea gameinunity3d
Dao Tung
 
Ben Atherton 2D Side Scrolling Shooter Workflow
Ben_Atherton
 
Unity workshop
fsxflyer789Productio
 
Laser Defender Game in Unity3D
CompleteUnityDeveloper
 
Work flow the pain is reel
Shaz Riches
 
Work flow
Shaz Riches
 
2D Top-down shooter workflow
raimondklavins
 
Construct 2 Platformer: Step by Step
Shahed Chowdhuri
 
Work Flow
Kalen612
 
2 d gameplaytutorial
unityshare
 
Jake Hyatt 2D Game Workflow
Jakeyhyatt123
 
Work Flow
Kalen612
 
Unreal Engine Basics 02 - Unreal Editor
Nick Pruehs
 
2d game engine workflow
luisfvazquez1
 
Creating A Character in Uncharted: Drake's Fortune
Naughty Dog
 
Fmp production reflection part 1
sean cawood
 
Ad

More from BeMyApp (20)

PPTX
Introduction to epid
BeMyApp
 
PDF
Introduction ciot workshop premeetup
BeMyApp
 
PPTX
Présentation des APIs cognitives IBM Watson
BeMyApp
 
PDF
Crédit Agricole S.A. Personae et Parcours
BeMyApp
 
PDF
Cisco Paris DevNet Hackathon slideshow - Intro
BeMyApp
 
PPTX
Tumeurs Neuroendocrines : une vue d'ensemble
BeMyApp
 
PDF
Using intel's real sense to create games with natural user interfaces justi...
BeMyApp
 
PPTX
Introduction to using the R200 camera & Realsense SDK in Unity3d - Jon Collins
BeMyApp
 
PPTX
Audio Mixer in Unity5 - Andy Touch
BeMyApp
 
PDF
Shaders - Claudia Doppioslash - Unity With the Best
BeMyApp
 
PDF
[HACKATHON CISCO PARIS] Slideshow du workshop Smart City
BeMyApp
 
PDF
Tools to Save Time
BeMyApp
 
PDF
[Workshop e résidents] présentation intent, craft ai, dalkia et incubateur
BeMyApp
 
PDF
[Webinar E-résidents #1] Présentation des différents métiers du bâtiment conn...
BeMyApp
 
PPTX
[IoT World Forum Webinar] Review of CMX Cisco technology
BeMyApp
 
PDF
HP Helion Episode 6: Cloud Foundry Summit Recap
BeMyApp
 
PDF
Webinar UI/UX by Francesco Marcellino
BeMyApp
 
PDF
HP Helion Webinar #5 - Security Beyond Firewalls
BeMyApp
 
PDF
HP Helion Webinar #4 - Open stack the magic pill
BeMyApp
 
PDF
HP Helion European Webinar Series ,Webinar #3
BeMyApp
 
Introduction to epid
BeMyApp
 
Introduction ciot workshop premeetup
BeMyApp
 
Présentation des APIs cognitives IBM Watson
BeMyApp
 
Crédit Agricole S.A. Personae et Parcours
BeMyApp
 
Cisco Paris DevNet Hackathon slideshow - Intro
BeMyApp
 
Tumeurs Neuroendocrines : une vue d'ensemble
BeMyApp
 
Using intel's real sense to create games with natural user interfaces justi...
BeMyApp
 
Introduction to using the R200 camera & Realsense SDK in Unity3d - Jon Collins
BeMyApp
 
Audio Mixer in Unity5 - Andy Touch
BeMyApp
 
Shaders - Claudia Doppioslash - Unity With the Best
BeMyApp
 
[HACKATHON CISCO PARIS] Slideshow du workshop Smart City
BeMyApp
 
Tools to Save Time
BeMyApp
 
[Workshop e résidents] présentation intent, craft ai, dalkia et incubateur
BeMyApp
 
[Webinar E-résidents #1] Présentation des différents métiers du bâtiment conn...
BeMyApp
 
[IoT World Forum Webinar] Review of CMX Cisco technology
BeMyApp
 
HP Helion Episode 6: Cloud Foundry Summit Recap
BeMyApp
 
Webinar UI/UX by Francesco Marcellino
BeMyApp
 
HP Helion Webinar #5 - Security Beyond Firewalls
BeMyApp
 
HP Helion Webinar #4 - Open stack the magic pill
BeMyApp
 
HP Helion European Webinar Series ,Webinar #3
BeMyApp
 

Recently uploaded (20)

PDF
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
Software Development Methodologies in 2025
KodekX
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 

Building your first game in Unity 3d by Sarah Sexton

  • 2. Introduction Sarah Sexton Technical Evangelist Twitter: @Saelia Microsoft, Chicago, IL http://aka.ms/sarahsexton www.SheBuildsGames.com [email protected]
  • 4. Customizing your Workspace 1. Setup Editor Layout 2 by 3 2. Drag Project tab below the Hierarchy 3. Set view slider to minimum on Project panel
  • 5. File > New Scene File > Save Scene As, name it Nightmares 01 in Scenes folder Customizing your Workspace
  • 6. Environment 1. Locate Environment Prefabs in the Project panel Prefabs folder 2. Drag into Scene or Hierarchy 3. Ensure it is at Position (0,0,0) in Transform 4. Repeat 1-3 for the Lights prefabs 5. Save your Scene (Ctrl+S) (Nightmares 02)
  • 7. Environment 1. GameObject menu > 3D Object > Quad 2. Rename to Floor 3. Ensure it is at Position (0,0,0) in Transform 4. Set Rotation (90, 0 0) in Transform 5. Set Scale to (100, 100, 1) in Transform
  • 8. Environment 1. Remove Mesh Renderer Component from the Floor game object 2. Set the Floor game object to use the Floor layer at the top of the Inspector panel 3. Save your Scene (Ctrl+S) (Nightmares 03)
  • 9. Environment 1. GameObject > Create Empty 2. Rename GameObject to BackgroundMusic 3. Add Component > Audio > Audio Source
  • 10. 1. Audio Clip > Circle Select > Background Music 2. Check Loop and set Volume to 0.1 3. Save your Scene (Ctrl+S) (Nightmares 04) Circle Select
  • 12. Phase Two: Player Character
  • 13. Player Character 1. Locate the Player model in Models > Characters folder of the Project panel 2. Drag it into the Scene or Hierarchy panels 3. Set the Position to (0,0,0) in Transform 4. Set the Tag to Player in the drop-down in Inspector
  • 14. Player Character 1. Select the Animation folder and click Create on the Project panel, choose Animator Controller 2. Name this new asset PlayerAC 3. Drag and drop it onto the Player in the Hierarchy
  • 15. 1. Double-click PlayerAC asset in Project > Animation 2. Dock the Animator window by the Scene view
  • 16. Player Character 1. Expand the Player model in Models > Characters 2. Drag the Idle, Move and Death animations to empty space in the Animator window to create states. 3. Right-click Idle state and choose Set as Default 4. Create a bool parameter named IsWalking 5. Create a Trigger parameter named Death
  • 17. Player Character 1. Right-click Idle and Make Transition to Move 2. Select the Transition arrow you made 3. Set the Condition for this to IsWalking = true 4. Right-click Move and Make Transition to Idle 5. Set the Condition for this to IsWalking = false 6. Right-click ‘Any State’ and Make Transition to Death
  • 19. Player Character 1. Set Condition for this to Death (trigger) 2. Select Player game object, Add Component > Physics > Rigidbody 3. Set Drag & Angular Drag to Infinity 4. Expand the Constraints, Freeze the Y Position, and Freeze the X and Z Rotations
  • 20. Player Character 1. Select Player game object, Add Component > Physics > Capsule Collider 2. Set Center to (0.2, 0.6, 0) 3. Set Height to 1.2
  • 21. Player Character 1. Add Component > Audio > Audio Source 2. Audio Clip > Circle select Player Hurt 3. Uncheck Play On Awake 4. Locate PlayerMovement script in Scripts > Player 5. Drag & Drop this to Player game object in Hierarchy 6. Save your Scene (Ctrl+S) (Nightmare 05)
  • 22. Player Character 1. Double-click the icon of the PlayerMovement script to open it in the Script editor.
  • 24. Player Character: Move, Normalization
  • 25. Player Character – Raycasting, Quaternions
  • 27. Player Character 1. File > Save your script and return to the Unity editor 2. Press Play at the top of the interface to try out your game! 3. Stop Play (do not use Pause.) DEMO
  • 29. Phase Three: Camera Setup 1. Select the Main Camera in Hierarchy 2. Set the Transform Position to (1, 15, -22) 3. Set the Transform Rotation to (30, 0, 0) 4. In the Camera component set the Projection to Orthographic mode 5. Set the Size value 4.5
  • 30. Camera Setup 1. Set Background Color to Black 2. Save your Scene (Ctrl+S) 3. Select the Camera folder in the Scripts folder of the Project panel 4. Click Create > C# Script on Project panel 5. Name the script CameraFollow
  • 31. Camera Setup 1. Drag and drop the CameraFollow script onto the Main Camera in Hierarchy 2. Save your scene now! 3. Click Open at the top of the Inspector or double-click the script’s icon to open it for editing
  • 35. Camera Setup 1. Save your Script, and return to Unity 2. Select the MainCamera and assignment Player from the Hierarchy to the Target variable on CameraFollow 3. Save your Player as a Prefab by dragging the Player game object from Hierarchy to the Prefabs folder in the Project. Save, and press Play to test!

Editor's Notes

  • #2: Unity is a fully integrated game engine that you use to create games and other 3D interactive content. You import assets such as 3D models and textures, and then assemble these art assets into a game in Unity. When your Unity project is completed, you then build the project to a desired platform, such as web, mobile or desktop.
  • #3: My responsibilities include speaking to user groups, writing cool pieces of code, blogging and tweeting about Microsoft services, and reaching out to the development community and students. I help student, community, and startup developers find success on Windows. I work with them via local user groups, speaking at conferences and universities where I can talk about anything ranging from why windows is right for you, to actual coding advice for apps.
  • #4: Project Browser: In this view, you can access and manage the assets that belong to your project. http://docs.unity3d.com/Manual/ProjectView.html Hierarchy: The Hierarchy contains every GameObject in the current Scene. The Scene View is your interactive sandbox. You will use the Scene View to select and position environments, the player, the camera, enemies, and all other GameObjects.  The Inspector displays detailed information about your currently selected GameObject, including all attached Components and their properties. Here, you modify the functionality of GameObjects in your scene. The Toolbar consists of five basic controls that relate to different parts of the Editor. Pan, Move, Rotate, Scale, Resize. Transform Gizmo Toggles – affect the Scene View display Play/Pause/Step Buttons. Layers Drop-down – controls which objects are displayed in Scene View Layout Drop-down – controls arrangement of all Views
  • #25: Public float speed = 6f; Vector3 movement; Animator anim; Rigidbody playerRigidbody; Int floorMask; Float camRayLength = 100f;
  • #26: void Awake () { floorMask = LayerMask.GetMask (“Floor”); Anim = GetComponent <Animator> (); playerRigidbody = GetComponent <Rigidbody> (); } void FixedUpdate() { float h = Input.GetAxisRaw (“Horizonal”); float v = Input.GetAxisRaw (“Vertical”); }
  • #27: void Move (float h, float v) { movement.Set (h, 0f, v); movement = movement.normalized * speed * Time.deltaTime; playerRigidbody.MovePosition (transform.position + movement); }
  • #28: void Turning() { Ray camRay = Camera.main.ScreenPointToRay (Input.mousePosition); RaycastHit floorHit; if (Physics.Raycast (camRay, out floorHit, camRayLength, floorMask)) { Vector3 playerToMouse = floorHit.point - transform.position; playerToMouse.y = 0f; Quaternion newRotation = Quaternion.LookRotation (playerToMouse); playerRigidbody.MoveRotation (newRotation); } } //Quaternion = defines the desired rotation that the joint should rotate into.
  • #29: void Animating (float h, float v) { bool walking = h != 0f || v != 0f; anim.SetBool (“IsWalking”, walking); } void FixedUpdate() { float h = Input.GetAxisRaw (“Horizonal”); float v = Input.GetAxisRaw (“Vertical”); Move (h, v); Turning (); Animating (h, v); }
  • #40: Unity is a fully integrated game engine that you use to create games and other 3D interactive content. You import assets such as 3D models and textures, and then assemble these art assets into a game in Unity. When your Unity project is completed, you then build the project to a desired platform, such as web, mobile or desktop.