# Implementing picking using ray casting

Let's now start implementing what we have discussed. The algorithm we will apply is as follows:

- Create a rigid body for each scene object.
- Calculate the click coordinates of the canvas, convert these coordinates to normalized device coordinates, and create a vector.
- "Unproject" the vector using the camera projection matrix.
- Create a ray segment using the vector.
- Check for an intersection.
- If an intersection is found, then change the color of the selected object.

## Using a rigid body (collider) for each scene object

Now, we will modify our `StageObject`

class again to create a bounding box. If we revisit the constructor of our `jigLib.JBox`

class, then its constructor takes the width, depth, and height of the corresponding ...