Edge Collision

The Edge Collision behavior is ideal for setting up complex motion simulations with objects that do not exit the canvas. Objects with the Edge Collision behavior applied come to a stop or bounce after colliding with the edge of the canvas frame. For example, if you apply the Throw behavior to an object and set the velocity to send the object toward the edge of the frame, then apply Edge Collision, the object will bounce off the edge of the frame according to the Bounce Strength parameter. Edge Collision has no effect on objects larger than the canvas.

The angle at which the object bounces depends on the angle at which it hits the edge of the frame; the speed it travels after bouncing is set by the Bounce Strength parameter.

Important: By default, the Edge Collision behavior uses the size of the project and the bounding box to determine how the object collides with the edge of the canvas. In a project, an object bounces off the right and left edges of the project at its bounding box. With groups (particles, text, and objects), only the object’s center is used. You can make the object travel farther off the canvas before it bounces by adjusting the Width and Height parameters. If you’re using this behavior with an object that has an alpha channel that’s smaller than its bounding box, adjust the Crop parameter in the object’s Properties Inspector to fit the bounding box as closely as possible to the edge of the image.

Adjust this behavior using the controls in the Behaviors Inspector: