Physics Scripting: Gravity, Collisions, and Forces Quiz Quiz

Explore core concepts of gravity, collision handling, and force dynamics in physics scripting. This quiz assesses your understanding of realistic motion simulation, force calculation, and managing object interactions within a digital environment.

  1. Gravity in Scripted Environments

    In a scripted 2D physics simulation, which of the following formulas best applies constant downward gravity to an object each frame?

    1. object.velocity.y += gravity * deltaTime
    2. object.velocity.x += gravity * deltaTime
    3. object.mass *= gravity
    4. object.position.y -= gravity

    Explanation: The correct way to apply gravity is by incrementally changing the object's vertical velocity using gravity multiplied by the time step (deltaTime). This mirrors real-world acceleration due to gravity. Subtracting gravity from position skips velocity, leading to unrealistic movement. Applying gravity to the x-axis does not simulate downward gravity. Adjusting mass with gravity is physically nonsensical in this context.

  2. Collision Response Types

    Which collision response best represents an elastic collision between two moving balls in a simulation?

    1. Both balls exchange velocities based on their masses and conserve total kinetic energy
    2. One ball stops while the other continues with both velocities added
    3. Both balls reverse directions regardless of speed
    4. Both balls lose all velocity and stick together

    Explanation: An elastic collision preserves both momentum and kinetic energy, resulting in an exchange of velocities depending on masses. One ball stopping and the other moving with combined speed represents a non-physical scenario. Sticking together after impact (option three) describes a perfectly inelastic collision. Simply reversing directions ignores mass and initial velocities, making it an inaccurate representation.

  3. Forces in Friction Simulation

    If an object slides across a surface and slows down due to friction, which script would most accurately simulate this effect?

    1. object.velocity.y -= friction * deltaTime
    2. object.position.x += friction
    3. object.mass -= friction
    4. object.velocity.x -= friction * deltaTime

    Explanation: Friction is modeled by decreasing the velocity over time in the direction of movement, hence subtracting friction from the x-component of velocity is appropriate here. Adding friction to position bypasses velocity, resulting in improper simulation. Adjusting mass with friction is incorrect since friction does not affect mass. Modifying the y-velocity simulates vertical friction, whereas sliding here occurs along x.

  4. Impulse on Collision

    When two objects collide and you want to instantly change their velocities based on impact force in a script, which concept should be applied?

    1. Gravity acts stronger during collision
    2. Impulse equals the change in momentum over the collision duration
    3. Mass remains constant but velocity is ignored
    4. Friction increases speed momentarily

    Explanation: Impulse describes the change in momentum as a result of a force applied over a short time, which is how brief impacts are handled in collision scripts. Gravity does not become stronger during collision; its effect is continuous. Friction never increases speed; it reduces it. Velocity cannot be ignored since it directly impacts the momentum before and after the collision.

  5. Detecting Overlapping Objects

    In physics scripting, what method is typically used to check if two rectangular objects have collided?

    1. Adding together gravity values
    2. Subtracting masses of the objects
    3. Comparing bounding boxes to check for overlap
    4. Multiplying their velocities

    Explanation: The standard approach is to compare the bounding boxes of objects to determine if they overlap, indicating a collision. Multiplying velocities or subtracting masses does not relate to collision detection. Adding gravity values is unrelated to detecting overlaps between objects, as gravity refers to force, not spatial proximity.