Complete the code to add a Rigidbody2D component to the GameObject.
gameObject.AddComponent<[1]>();The Rigidbody2D component is added to enable 2D physics on the GameObject.
Complete the code to set the Rigidbody2D's gravity scale to zero.
Rigidbody2D rb = GetComponent<Rigidbody2D>(); rb.[1] = 0f;
The gravityScale property controls how much gravity affects the Rigidbody2D.
Fix the error in the code to apply a force to the Rigidbody2D.
Rigidbody2D rb = GetComponent<Rigidbody2D>();
rb.AddForce([1]);The AddForce method for Rigidbody2D requires a Vector2 argument representing force in 2D space.
Fill both blanks to create a Rigidbody2D and set its body type to Kinematic.
Rigidbody2D rb = gameObject.AddComponent<[1]>(); rb.[2] = RigidbodyType2D.Kinematic;
You add a Rigidbody2D component and set its bodyType property to RigidbodyType2D.Kinematic to make it kinematic.
Fill all three blanks to get the Rigidbody2D, set its mass, and apply an upward force.
Rigidbody2D [1] = GetComponent<Rigidbody2D>(); [1].[2] = 5f; [1].AddForce(new Vector2(0, [3]));
We get the Rigidbody2D component as rb, set its mass to 5, and apply an upward force of 10 on the y-axis.