Fundaments of Game Design

Slides:



Advertisements
Similar presentations
Operational & Function Keys Notes 2
Advertisements

Objectives © Paradigm Publishing, Inc. 1 Objectives.
INNER WORKINGS OF UNITY 3D. WHAT WE ARE GOING TO COVER Intro to Unity Physics & Game Objects Cameras & Lighting Textures & Materials Quaternions and Rotation.
GameCamp! and Game Davis Creating a 2D Platformer in Unity.
GameCamp! and Game Davis Introduction to Scripting in Unity®
Get to Know Your Keyboard. Operational Keys Escape (Esc) – allows you to exit unwanted menus and dialog boxes Tab – used to indent; moves the cursor 5.
Forces. Force = A push or a pull Push PuLL What things produce forces? PUSH PULL.
1. Chapter 4 Customizing Paragraphs 3 More Paragraph Changes Highlight a paragraph in Word by applying borders and shading. Sort paragraphs to control.
Unit 1. Alternate Key Also called ALT key Executes commands with other key(s)
Learning Unity. Getting Unity
GameDevClub CODE CHEAT SHEET NOTE: ALL OF THE CODE IS CASE-SENSITIVE AND THE SYNTAX IS STRICT SO A LOT OF YOUR ERRORS WILL PROBABLY COME FROM TYPOS If.
Expressive Intelligence Studio // Center for Games and Playable Media // Unity Pro John Murray Expressive.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
COMPUTER INPUT DEVICE Keyboard. Keyboard cont…… Print Screen Print contents of screen Pause/Break Terminate/Interrupt Scroll Lock Modify behavior of the.
Behavior trees & The C# programming language for Java programmers
Game Development with Unity3D
Section 10.1 Define scripting
1.4 Keyboard Training.
EEC-693/793 Applied Computer Vision with Depth Cameras
Quick Intro to Unity Lecture 2.
Computer Fundamentals 1
Scratch for Interactivity
Lecture 2 Richard Gesick
Unity 2D: Step by Step, Part 4
EEC-693/793 Applied Computer Vision with Depth Cameras
Accsess 2013 Creating Database.
Keyboards, Pages & Transforms
Mouse & Keyboard Basics
Forging new generations of engineers
Introduction to Events
Using the Keyboard And Mouse
Forging new generations of engineers
Formatting and Editing Skills
EEC-693/793 Applied Computer Vision with Depth Cameras
Document Processing Part 2
Loopy Motion Control.
Keyboarding Objective – Apply formatting and editing features.
1.4 Keyboard Training Keyboard Training.
Event-driven Programming
Formatting and Editing Skills
An Introduction to Word Processing
Formatting and Editing Skills
Formatting and Editing Skills
Keyboarding Objective – Apply formatting and editing features.
Forging new generations of engineers
Benchmark Series Microsoft Word 2016 Level 1
Benchmark Series Microsoft Word 2016 Level 2
Formatting and Editing Skills
lecture 7 Our First Project
Keyboarding Objective – Apply formatting and editing features.
Week 6: Time and triggers!
Қош келдіңіздер! Информатика пәні 5 “А” сынып!.
Fundaments of Game Design
Building a Game in Scratch
KEYBOARD and IMPORTANT KEYS
Fundaments of Game Design
EEC-693/793 Applied Computer Vision with Depth Cameras
Virtual Keyboard Project
Year 9 Entry Level Computing
Input and Output devices in a Computer
01.00 Use the touch method in operating the keyboard and numeric keypad Objectives Execute the touch method in operating the alphabetic keys.
Keyboarding Vocabulary
Unity Game Development
Unity Game Development
Keyboarding Objective – Apply formatting and editing features.
Word Pad программасымен практикалық сабақ
Word Pad программасымен практикалық сабақ
Keyboarding Vocabulary
TERMS AND CONDITIONS   These PowerPoint slides are a tool for lecturers, and as such: YOU MAY add content to the slides, delete content from the slides,
Presentation transcript:

Fundaments of Game Design Unity Movement Richard Gesick

Objectives Using rigid bodies Applying forces Applying velocities Time intervals Key input

Rigidbodies Rigidbody is a component that should be added to game objects that are going to be affected by gravity or collisions. “Adding a Rigidbody component to an object will put its motion under the control of Unity's physics engine. Even without adding any code, a Rigidbody object will be pulled downward by gravity and will react to collisions with incoming objects if the right Collider component is also present.“

RigidBodies (2) The Rigidbody has a scripting API that lets you apply forces to the object and control it in a physically realistic way The FixedUpdate function is recommended as the place to apply forces and change Rigidbody settings. The reason for this is that physics updates are carried out in measured time steps that don't coincide with the frame update. FixedUpdate is called immediately before each physics update and so any changes made there will be processed directly. Rigidbody api

Applying a force to a rigidbody void FixedUpdate() { float hor = Input.GetAxis("Horizontal"); float ver = Input.GetAxis("Vertical"); Vector3 move = new Vector3(hor, 0.0f, ver); GetComponent<Rigidbody>().AddForce(move * speed * Time.deltaTime); }

Using Velocity We can use velocity instead of force but don’t use both. It will cause problems. Create the velocity vector, multiply it by speed and time and then add it to the rigidbody.position or transform.position

Using a velocity void FixedUpdate () { float hor = 0; float ver = 0; if (Input.GetKey ("a")) hor = -1; if (Input.GetKey ("d")) hor = 1; if (Input.GetKey ("w")) ver = 1; if (Input.GetKey ("s")) ver = -1; Vector3 vel = new Vector3 (hor, 0, ver); GetComponent<Rigidbody>().position+= vel * speed* Time.deltaTime; //or GetComponent<Transform>().position+=vel*speed* Time.deltaTime; }

Key input Input.GetAxis("Horizontal"); is set by unity as the a and d keys as well as the left and right arrows Input.GetAxis(“Vertical"); is set by unity as the w and s keys as well as the up and down arrows Input.GetKey returns true thru each frame as long as the key is down if (Input.GetKey ("a")) Input.GetKeyDown( string name) (or up) returns true just once, in the frame that it is pressed in and doesn’t generate a new value until it has been released and pressed if (Input.GetKeyDown ("d"))

Key naming Normal keys: “a”, “b”, “c” … Number keys: “1”, “2”, “3”, … Arrow keys: “up”, “down”, “left”, “right” Keypad keys: “[1]”, “[2]”, “[3]”, “[+]”, “[equals]” Modifier keys: “right shift”, “left shift”, “right ctrl”, “right alt”, “left alt”, “right cmd”, Mouse Buttons: “mouse 0”, “mouse 1”, “mouse 2”, … Joystick Buttons (from any joystick): “joystick button 0”, “joystick button 1”, Joystick Buttons (from a specific joystick): “joystick 1 button 0”, “joystick 1 Special keys: “backspace”, “tab”, “return”, “escape”, “space”, “delete”, “enter”, “insert”, “home”, “end”, “page up”, “page down” Function keys: “f1”, “f2”, “f3”, … The names used to identify the keys are the same in the scripting interface and the Inspector.