SC_sphereCast
SYNTAX
return integer=SC_sphereCast ( objNum, oldx, oldy, oldz, x, y, z, radius, excludeObj )
-objNum: the object you want to check for collision use 0 for all objects
-oldx...z: the start and end points of the sphere to check.
-radius: the radius of the sphere you want to cast.
-excludeObj: an object to exclude from the collision check.
returns: if objNum=0 then the object number collided with is returned
if checking a specific object then a 1 is returned if a collision occured.
returns 0 if no collision occured.
Will check if the ray starting at oldx#,oldy#,oldz# and ending at
x#,y#,z#, and of width radius#, collides with the specified object (obj=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 SC_sphereSlide
The collision point returned (which can be retrieved using SC_getStaticCollision()) is
the point where the sphere is during collision, not the actual point of collision between
sphere and object. A slide point is also returned by this command (use SC_getCollisionSlide()) but should
not be used for true sliding collision as SC_sphereCast only does one iteration of checks
see SC_sphereSlide
for detailed sliding collision.
RELATED INFO
Collision Commands Menu
Index