0
0
Unityframework~10 mins

Physics materials (friction, bounce) in Unity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a new Physics Material with a bounce of 0.5.

Unity
PhysicsMaterial2D material = new PhysicsMaterial2D();
material.bounciness = [1];
Drag options to blanks, or click blank then click option'
A0.5
B0
C1.0
D-0.5
Attempts:
3 left
💡 Hint
Common Mistakes
Using a negative value for bounciness causes no effect.
Setting bounciness to 1 makes the object bounce fully, not halfway.
2fill in blank
medium

Complete the code to assign a Physics Material with friction 0.3 to a Collider2D component.

Unity
PhysicsMaterial2D mat = new PhysicsMaterial2D();
mat.friction = [1];
Collider2D col = gameObject.GetComponent<Collider2D>();
col.sharedMaterial = mat;
Drag options to blanks, or click blank then click option'
A0
B1.0
C0.3
D-0.3
Attempts:
3 left
💡 Hint
Common Mistakes
Using negative friction values is invalid.
Setting friction to 0 means no resistance to sliding.
3fill in blank
hard

Fix the error in the code to correctly set the bounce combine mode to 'Multiply'.

Unity
PhysicsMaterial2D mat = new PhysicsMaterial2D();
mat.bounceCombine = [1];
Drag options to blanks, or click blank then click option'
APhysicsMaterialCombine.Multiply
BPhysicsMaterialCombine.Minimum
CPhysicsMaterialCombine.Maximum
DPhysicsMaterialCombine.Average
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Average' instead of 'Multiply' changes bounce behavior.
Assigning string values instead of enum causes errors.
4fill in blank
hard

Fill both blanks to create a Physics Material with friction 0.6 and friction combine mode set to 'Minimum'.

Unity
PhysicsMaterial2D mat = new PhysicsMaterial2D();
mat.friction = [1];
mat.frictionCombine = [2];
Drag options to blanks, or click blank then click option'
A0.6
BPhysicsMaterialCombine.Average
CPhysicsMaterialCombine.Minimum
D1.0
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up combine modes changes physics behavior.
Using friction values outside 0-1 range causes unexpected results.
5fill in blank
hard

Fill all three blanks to create a Physics Material with bounce 0.8, bounce combine mode 'Maximum', and friction 0.4.

Unity
PhysicsMaterial2D mat = new PhysicsMaterial2D();
mat.bounciness = [1];
mat.bounceCombine = [2];
mat.friction = [3];
Drag options to blanks, or click blank then click option'
APhysicsMaterialCombine.Minimum
BPhysicsMaterialCombine.Maximum
C0.4
D0.8
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing bounce and friction values.
Using wrong combine mode changes physics behavior.