# ObjectSphereCast

## Description

Will check if the ray starting at oldx, oldy, oldz and ending at newx, newy, newz, and of width radius, collides with the specified object (objID=0 for all). Does not collide with backfaces, will return the number of the object hit first, or 0 for no collision. Sphere casting commands add a width dimension to normal ray casting which can be used to check if a player has hit anything during movement and to position them at the collision point to provide 'sticky' collision, where the player stops if they hit anything. The alternative is sliding collision. see ObjectSphereSlide

## Definition

integer ObjectSphereCast( objID, oldx, oldy, oldz, newx, newy, newz, radius )

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

## 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.
- radius - The radius of the sphere to cast.