# ObjectRayCast

## Description

Casts a ray through 1 or all objects to check for intersection with the object. Rays are define with a start position and an end position and does not collide with backfaces, will return the number of the object hitt first, or 0 for no collision. Ray casting commands are useful for calculating the collisions of bullets with levels and objects, or for representing the line of sight of an enemy to detect if they can see the player.

## Definition

integer ObjectRayCast( objID, oldx, oldy, oldz, newx, newy, newz )

int agk::ObjectRayCast( UINT objID, float oldx, float oldy, float oldz, float newx, float newy, float newz )

## Parameters

- objID - The ID of the object to check, 0 for all objects.
- oldx - The X component of the start position.
- oldy - The Y component of the start position.
- oldz - The Z component of the start position.
- newx - The X component of the end position.
- newy - The Y component of the end position.
- newz - The Z component of the end position.