Which of the following components do you need to properly set up physics based on a 2D Player character? (Choose two)
Unity gMetrix Module 5

Quiz
•
Computers
•
12th Grade
•
Medium
Raymundo Martinez
Used 1+ times
FREE Resource
5 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
5 mins • 1 pt
Rigidbody2D
Rigidbody
Trigger
2D Collider
Answer explanation
With only a Rigidbody2D and a 2D type collider, you can set up a physics-based 2D GameObject.
2.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
A programmer created the code below to read input from the user and make the character jump when the Space key on the keyboard is pressed. The problem is that the character flies too high when the user presses the key. What is causing this issue?
bool fly;
void Update(){
if(Input.GetKey(Keycode.Space)){
fly = true;
}
}
void FixedUpdate(){
if(fly){
fly = false;
rb.AddForce(Vector3.up, ForceMode. Impulse);
}
}
Rigidbody mass is too low.
GetKey gets called every frame the key is pressed.
Input reading must be done on FixedUpdate.
Force should be multiplied by Time.deltaTime.
Answer explanation
In this case, the issue is that GetKey gets called every frame the key is pressed. To fix the issue, GetKey should be replaced by GetKeyDown to work only on the first frame
the key gets pressed.
3.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
The following code is assigning a vector to the player's transform position. What behaviour will this cause on the player GameObject? Vector2 customVector; void Start(){ customVector = -Vector3.up; } void Update(){ transform.position += customVector; }
Moves the player to the right
Moves the player forward
Moves the player to the left
Moves the player down
Answer explanation
It will move the player down because a negative version of Vector2.up is equal to Vector2.down.
4.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Select the proper combination of code snippets that will create a valid method that reads Input from the player: 1:{ 2: void ReadInputFromPlayer( 3: Input.GetKeyDown(KeyCode.W)(){ 4:} 5: if(Input.GetKeyDown(KeyCode.W)){
1, 2, 3, 4
2, 4, 2, 3
2, 1, 3, 4
2, 1, 5, 4
Answer explanation
2, 1, 5, 4 is the only combination that has the proper order and condition to ask for input.
5.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Select the combination of code snippets that will properly declare a variable not accessible from another script but available in the Inspector.
1: power = 1;
2: [SerializeField]
3: public
4: private
5: int
6: static
3, 6, 5, 1
2, 3, 5, 1
4, 6, 5, 1
2, 4, 5, 1
Answer explanation
When you need to have a variable available in the Inspector but keep it private, the proper way is to use a combination of private access modifier and the [SerializeField]
attribute, so 2, 4, 5, 1 is the correct order.
Similar Resources on Wayground
10 questions
JS PRACTICE - TEST ERRORS

Quiz
•
12th Grade
10 questions
Computer Basics

Quiz
•
11th - 12th Grade
10 questions
Exploring Python: Input and Output Essentials

Quiz
•
9th Grade - University
10 questions
Functions in C++

Quiz
•
9th - 12th Grade
10 questions
HTML5 Forms

Quiz
•
11th - 12th Grade
10 questions
Intro to Python

Quiz
•
KG - University
10 questions
Hardware

Quiz
•
9th - 12th Grade
10 questions
YouCode Scratch Quiz

Quiz
•
KG - 12th Grade
Popular Resources on Wayground
25 questions
Equations of Circles

Quiz
•
10th - 11th Grade
30 questions
Week 5 Memory Builder 1 (Multiplication and Division Facts)

Quiz
•
9th Grade
33 questions
Unit 3 Summative - Summer School: Immune System

Quiz
•
10th Grade
10 questions
Writing and Identifying Ratios Practice

Quiz
•
5th - 6th Grade
36 questions
Prime and Composite Numbers

Quiz
•
5th Grade
14 questions
Exterior and Interior angles of Polygons

Quiz
•
8th Grade
37 questions
Camp Re-cap Week 1 (no regression)

Quiz
•
9th - 12th Grade
46 questions
Biology Semester 1 Review

Quiz
•
10th Grade