SET OBJECT COLLISION TO POLYGONS This command will set the specified 3D object to use polygon checking for collision detection.
Syntax
    SET OBJECT COLLISION TO POLYGONS Object Number
Parameters
    Object Number
Integer The object number
Returns
This command does not return a value.
Description
Polygon detection is much slower that box and sphere detection, but allows you to detect perfect collision against an object that has a complex polygon structure. The parameter should be specified using an integer value. When a polygon test is carried out, the primary object is always treated as a polygon object and the secondary object is always a sphere representative of the size of the second object. This method is significantly faster that a test against two polygon structures.
Example Code
    sync on : sync rate 60 : hide mouse:cls 0

    autocam off

    set global collision on

    ObjectNumber=1

    SecondObject=2

    make object sphere ObjectNumber,10

    color object ObjectNumber,rgb(0,255,0)

    position object ObjectNumber, 0,0,0

    make object cone secondObject,10

    xrotate object secondObject,90

    fix object pivot secondObject

    color object SecondObject,rgb(255,0,0)

    position object SecondObject, 15,0,0

    while mouseclick()=0

    set object collision to polygons ObjectNumber

    set object collision to polygons SecondObject

    if leftkey()=1 then turn object left SecondObject,1

    if rightkey()=1 then turn object right SecondObject,1

    if upkey()=1 and OBJECT HIT(SecondObject,0)=0 then move object SecondObject,1

    if downkey()=1 and OBJECT HIT(SecondObject,0)=0 then move object SecondObject,-1

    if returnkey()=1 then position object SecondObject,15,0,0

    if OBJECT HIT(SecondObject,0) then exit

    position camera object position x(SecondObject),object position y(SecondObject)+50,object position z(SecondObject)

    point camera object position x(SecondObject),0,object position z(SecondObject)

    sync

    endwhile

    set global collision off

    delete object ObjectNumber

    delete object SecondObject

    end
See also
BASIC3D Commands Menu Index