GameMaker (2.0 - 2.2.x)

Nearest Collision Point

Jordan Robinson

You must be logged in to obtain assets


point_array = collision_line_find_nearest_point(x1, y1, x2, y2, accuracy in pixels, solid object id, precise);

This script returns the position of a collision along a line using minimal collision checks.

An example project is included with a laser beam colliding against boxes.

The example project can accurately calculate the collision point in approximately 10 collision checks.

End User Licence Agreement (EULA).

Age Rating: 4+


GMS2 - Version 1.1.0. Published December 27, 2018

Added option to allow precise collision checking.

Example updated to show this.

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait