3D Cameras and Enemies COSC 315 Fall 2014 Bridget M. Blodgett.

Slides:



Advertisements
Similar presentations
Defining the Viewing Coordinate System
Advertisements

Sprites, User Input, and Collision COSC 315 Fall 2014 Bridget M. Blodgett.
1 3D Vector & Matrix Chapter 2. 2 Vector Definition: Vector is a line segment that has the direction. The length of the line segment is called the magnitude.
From Gears to The Machine in 13 Steps Carolyn Smith COSC /6/2009.
University of Bridgeport
Translate, Rotate, Matrix Pages Function Function Definition Calling a function Parameters Return type and return statement.
Three Dimensional Modeling Transformations
Airplane Flight: X-Plane in the Classroom Control Pitch - nose moves up and down.
Alice: A Visual Introduction to Programming Chapter 1 Part 3.
3D Kinematics Eric Whitman 1/24/2010. Rigid Body State: 2D p.
Simple 3D Camera Game Design Experience Professor Jim Whitehead March 6, 2009 Creative Commons Attribution 3.0 (Except copyrighted images) creativecommons.org/licenses/by/3.0.
3-D Geometry.
Introduction to ROBOTICS
The Accelerometer and Gyroscope
3D VIEWING ILLUSTRATED. WHAT YOU SEE DEPENDS ON YOUR POSITION In the real world, what you see depends on where you stand, the direction you look, how.
Computer Vision Group Prof. Daniel Cremers Autonomous Navigation for Flying Robots Lecture 3.1: 3D Geometry Jürgen Sturm Technische Universität München.
A Camera Class for OpenGL John McGuiness October 2006.
Finishing 2D COSC 315 Fall 2014 Bridget M. Blodgett.
AI & 2D Development COSC 315 Fall 2014 Bridget M. Blodgett.
J2ME: M3G/11 Intro to J2ME. Prog. v Objectives: –to introduce M3G; –to start talking about "M3G Chapter 2. An Animated Model" u leave the floor,
Week 2 - Wednesday CS361.
Maths and Technologies for Games Quaternions CO3303 Week 1.
Developing the Game User Interface (UI) Lesson 5.
1 Useful Tools for Making Video Games Part V An overview of.
User Input and Collisions COSC 315 Fall 2014 Bridget M. Blodgett.
Transforming Geometry Groundhog Day. Drawing Quads In a 300 by 200 window, draw two quads of different colors. Don’t show the grey grid.
Learning Unity. Getting Unity
Computer Graphics I, Fall 2010 Computer Viewing.
Object Oriented Design COSC 315 Fall 2014 Bridget M. Blodgett.
Sprites, User Input, and Collision COSC 315 Fall 2014 Bridget M. Blodgett.
CS-498 Computer Vision Week 7, Day 2 Camera Parameters Intrinsic Calibration  Linear  Radial Distortion (Extrinsic Calibration?) 1.
ADCS Review – Attitude Determination Prof. Der-Ming Ma, Ph.D. Dept. of Aerospace Engineering Tamkang University.
The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading.
3D Cameras COSC 315 Fall 2014 Bridget M. Blodgett.
XNA Basic Displaying Image & Collision Detect. What’s format image that XNA support? XNA support only.bmp.png and.jpg image..PNG have transparent region.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 17, 2015 TRANSFORMATIONS AFFINE TRANSFORMATIONS QUATERNIONS.
Lesson 3: Arrays and Loops. Arrays Arrays are like collections of variables Picture mailboxes all lined up in a row, or storage holes in a shelf – You.
Chapter 2: Description of position and orientation Faculty of Engineering - Mechanical Engineering Department ROBOTICS Outline: Introduction. Descriptions:
Derived from Kirill Muzykov’s Rocket Mouse Tutorial WakeUpAndCode.com.
Graphics CSCI 343, Fall 2015 Lecture 16 Viewing I
Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab 10: 3D & Projections Advanced.
Playing with Sprites. XNA Game Lifecycle In the faceBall demo program we bounced a smiley face around the graphical display against a background image.
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.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 16 – Craps Game Application Introducing Random-Number.
Arizona’s First University. Command and Control Wind Tunnel Simulated Camera Design Jacob Gulotta.
9.3 – Perform Reflections. Reflection: Transformation that uses a line like a mirror to reflect an image Line of Reflection: Mirror line in a reflection.
Mobile & Casual Gaming OpenGL ES Intro. /red/chapter03.html.
THE MAPLE LEAF FRACTAL Christina VoEPS 109 Fall 2013.
End effector End effector - the last coordinate system of figure Located in joint N. But usually, we want to specify it in base coordinates. 1.
TA: Ryan Freedman Sushma Kini Chi Zhou.  Due Date: March , 12:30 PM  We want a zip folder named cs418_mp1_{netid}.zip which contains  Source.
REFERENCE: QUATERNIONS/ Ogre Transformations.
Index Background Costumes Making object walk smoothly Controlling an object with the keyboard Control an object with the mouse Changing costume when hit.
Denavit-Hartenberg Convention
Game Design, Development, and Technology
10.1A Isometries Name four transformations? What is an isometry?
Denavit-Hartenberg Convention
COMPUTER GRAPHICS CHAPTERS CS 482 – Fall 2017 TRANSFORMATIONS
Animation & Games Module
+ SLAM with SIFT Se, Lowe, and Little Presented by Matt Loper
A Camera Class for OpenGL
Chapter 10 Algorithms.
The View Frustum Lecture 10 Fri, Sep 14, 2007.
Translate, Rotate, Matrix
Chapter 2 Mathematical Analysis for Kinematics
Chapter 10 Algorithms.
Game Programming Algorithms and Techniques
Online Pogo Game Customer Service
Pogo Game Customer Care Helpline Number

Call Pogo Contact Phone Number and Enjoy Pogo Game
Presentation transcript:

3D Cameras and Enemies COSC 315 Fall 2014 Bridget M. Blodgett

Rotations in a 3D Camera Up to this point we have rotated relative to the XYZ axes But you can rotate relative to the object within the game – These rotations are called Yaw, Pitch, and Roll Yaw is around the up vector Roll is around the direction vector Pitch is perpendicular to yaw and roll

Apply YPR In most 3D games the mouse is used to control the main camera You will need to determine the mouse input before you start applying camera YPR transformations First you want to center the mouse in the camera class: MouseState prevMouseState; (initialize method) Mouse.SetPosition(Game.Window.ClientBounds.Width/2, Game.Window.ClientBounds.Height/2); prevMouseState = Mouse.GetState();

Applying Transformation In the update method above CreateLookAt cameraDirection.Vector3.Transform(cameraDirection, Matrix.CreateFromAxisAngle(cameraUp, (- MathHelp.PiOver4/150) * (Mouse.GetState().X – previousMouseState.X))); prevMouseState = Mouse.GetState(); How would these transformations work for the other two types of transformations? Is there anything extra we need to take into account?

Moving Enemies Load the 3D game code from the book chapter 11 code This code incorporates a model and more realistic yaw and pitch controls (it removes the roll altogether) To add enemies that are a little more difficult we are going to make them roll randomly

Spinning Enemy You should now have a SpinningEnemy class available Create four class level variables: float yawAngle = 0; float pitchAngle = 0; float rollAngle = 0; Vector3 direction; Alter the constructor to make use of these new variables calling them yaw, pitch, and roll In the method definition assign the angle variables you made to the ones defined in the constructor (and direction to Direction)

Spinning Enemy Update will also need to be changed to apply the new variables rotation *= Matrix.CreateFromYawPitchRoll(yawAngle, pitchAngle,rollAngle); world *= Matrix.CreateTranslation(direction); GetWorld() should be changed as well public override Matrix GetWorld(){ return rotation * world; }

Adding Randomness Create a new random number in Game1 and initialize it in the constructor Also change the background color to black In ModelManager remove the spinning ship that is currently generated Make a new class called LevelInfo and make it match the following code:

namespace _3D_Game { class LevelInfo { public int minSpawnTime { get; set;} public int maxSpawnTime { get; set;} public int numberEnemies { get; set;} public int minSpeed { get; set;} public int maxSpeed { get; set;} public int missesAllowed { get; set;} public LevelInfo(int minSpawnTime, int maxSpawnTime, int numberEnemies, int minSpeed, int maxSpeed, int missesAllowed) { this.minSpawnTime = minSpawnTime; this.maxSpawnTime = maxSpawnTime; this.numberEnemies = numberEnemies; this.minSpeed = minSpeed; this.maxSpeed = maxSpeed; this.missesAllowed = missesAllowed; }

Making Use of Level Info In ModelManager add the following class level variables Vector3 maxSpawnLocation = new Vector3(100, 100, -3000); int nextSpawnTime = 0; int timeSinceLastSpawn = 0; float maxRollAngle = MathHelper.Pi / 40; int enemiesThisLevel = 0; int currentLevel = 0; List levelInfoList = new List ();

Making Use of Level Info In the ModelManager constructor add: levelInfoList.Add(new LevelInfo(1000, 3000, 20, 2, 6, 10)); levelInfoList.Add(new LevelInfo(900, 2800, 22, 2, 6, 9)); levelInfoList.Add(new LevelInfo(800, 2600, 24, 2, 6, 8)); levelInfoList.Add(new LevelInfo(700, 2400, 26, 3, 7, 7)); levelInfoList.Add(new LevelInfo(600, 2200, 28, 3, 7, 6)); levelInfoList.Add(new LevelInfo(500, 2000, 30, 3, 7, 5)); levelInfoList.Add(new LevelInfo(400, 1800, 32, 4, 7, 4)); levelInfoList.Add(new LevelInfo(300, 1600, 34, 4, 8, 3)); levelInfoList.Add(new LevelInfo(200, 1400, 36, 5, 8, 2)); levelInfoList.Add(new LevelInfo(100, 1200, 38, 5, 9, 1)); levelInfoList.Add(new LevelInfo(50, 1000, 40, 6, 9, 0)); levelInfoList.Add(new LevelInfo(50, 800, 42, 6, 9, 0)); levelInfoList.Add(new LevelInfo(50, 600, 44, 8, 10, 0)); levelInfoList.Add(new LevelInfo(25, 400, 46, 8, 10, 0)); levelInfoList.Add(new LevelInfo(0, 200, 48, 18, 20, 0));