2D Game Development 2D Physics and Collision Detection 2 — Questions and Answers
Question 1: What is the difference between dynamic and static rigidbodies in 2D physics?
- Dynamic bodies move and respond to forces; static bodies do not move (Correct answer)
- Static bodies are faster to render
- Dynamic bodies ignore gravity
- Static bodies can only be circles
Correct answer: Dynamic bodies move and respond to forces; static bodies do not move
Dynamic rigidbodies are affected by forces and gravity, while static rigidbodies remain fixed and serve as immovable terrain.
Question 2: What does 'friction' in a 2D physics engine control?
- How quickly an object stops when sliding (Correct answer)
- Object bounciness
- How fast an object falls
- Sprite opacity
Correct answer: How quickly an object stops when sliding
Friction is the resistance force applied to an object sliding along a surface, determining how quickly it decelerates.
Question 3: What is a 'kinematic' rigidbody in 2D game engines?
- A body driven by physics forces only
- A body moved by code without being affected by physics forces (Correct answer)
- A body that only collides with static objects
- A body that has infinite mass
Correct answer: A body moved by code without being affected by physics forces
Kinematic rigidbodies are moved directly via code (e.g., velocity or position) and are not affected by gravity or external forces.
Question 4: What is the Separating Axis Theorem (SAT) used for in 2D games?
- Sorting draw order
- Detecting collisions between convex shapes (Correct answer)
- Calculating gravity
- Rendering shadows
Correct answer: Detecting collisions between convex shapes
SAT determines if two convex shapes are overlapping by checking if a separating axis exists between them.
Question 5: What is impulse resolution in 2D physics?
- Applying an instant velocity change to resolve a collision (Correct answer)
- Gradual force application over time
- A method to remove colliders
- A rendering technique
Correct answer: Applying an instant velocity change to resolve a collision
Impulse resolution applies an instantaneous change in velocity to both colliding objects to separate them and simulate realistic bouncing.
Question 6: What is the purpose of a 'Layer Collision Matrix' in 2D physics?
- Control which physics layers can collide with each other (Correct answer)
- Assign visual depth to objects
- Define gravity per layer
- Organize objects in the scene hierarchy
Correct answer: Control which physics layers can collide with each other
A Layer Collision Matrix defines which pairs of physics layers can interact, allowing you to prevent unnecessary collision checks.
What is the difference between dynamic and static rigidbodies in 2D physics?