Section Index


1. OpenAL || 2. Debugging || 3. String Manipulation || 4. Networking || 5. Console || 6. Device I/O || 7. File I/O
8. Packages || 9. Objects || 10. Event Scheduling || 11. Datablocks || 12. Video / Texturing || 13. Special || 14. Resource Management
15. Scene || 16. Containers and Raycasts || 17. Editors || 18. Build || 19. Time || 20. GUIs || 21. Math


This quick reference guide was taken directly out of The Game Programmer's Guide to Torque by Edward Maurina. It's an outstanding resource - a must for anyone wanting to get serious about programming in Torque.


Contents

Containers and Raycasts

ContainerBoxEmpty( mask , location , xRadius [ , yRadius , zRadius ] )

Purpose
Use the ContainerBoxEmpty function to check for any objects of type mask within a box of variable size located at

Syntax
mask
– A bitmask corresponding to the type of objects to check for. See the 'Object Types Table'.
location – An XYZ position vector in the game world, pinpointing the centroid of the bounding box.
xRadius – The radius of the bounding box in the X-axis.
yRadius – The optional radius of the bounding box in the Y-axis.
zRadius – The optional radius of the bounding box in the Z-axis.

Returns
Returns true, if not objects were found, and false if objects were found.

Notes
If the yRadius and zRadius values are not supplied, they are assumed to be equal to xRadius.

See Also
containerFindFirst, containerFindNext, ContainerRayCast



containerFindFirst( mask , location, , xRadius , yRadius , zRadius )

Purpose
Use the containerFindFirst function to find the first instance of an object matching the type mask within the specified bounding box.

Syntax
mask
– A bitmask corresponding to the type of objects to check for. See the 'Object Types Table'.
location – An XYZ position vector in the game world, pinpointing the centroid of the bounding box.
xRadius – The radius of the bounding box in the X-axis.
yRadius – The optional radius of the bounding box in the Y-axis.
zRadius – The optional radius of the bounding box in the Z-axis.

Returns
Returns 0 if no objects are found, otherwise returns an integer representing the ID of the first object found.

See Also
ContainerBoxEmpty, containerFindNext, ContainerRayCast



containerFindNext()

Purpose
Use the containerFindNext function to find the next instance of an object in a bounding box search previously initiated with containerFindFirst.

Returns
Returns 0 if no objects are found, otherwise returns an integer representing the ID of the next object found.

See Also
ContainerBoxEmpty, containerFindFirst, ContainerRayCast



ContainerRayCast ( startPos , endPos , mask [ , exempt ] )

Purpose
Use the ContainerRayCast function to see if an object matching the specified mask type is positioned along a ray starting at startPos and ending at endPos. One object may be marked for expemption from ray cast collisions.

Syntax
startPos
– An XYZ vector containing the tail position of the ray.
endPos – An XYZ vector containing the head position of the ray.
mask – A bitmask corresponding to the type of objects to check for. See the 'Object Types Table'.
exempt – An optional ID for a single object that ignored for this raycast.

Returns
Returns 0 if no objects were struck by the ray, or a non-zero integer representing the ID of the object that was struck.

Notes
The exempt field is used to keep ray casts originating at an object from hitting the object itself.

See Also
ContainerBoxEmpty, containerFindFirst, containerFindNext



ContainerSearchCurrDist()

Purpose
Use the ContainerSearchCurrDist function when using InitContainerRadiusSearch and ContainerSearchNext functions to find objects to determine the distance of the center of the last object found from the center of the current search container.

Returns
Returns a floating point value equal to the distance between center the last found container search item and the center of the container search box.

Notes
Caution! Do not call this function without first setting up a search container or the engine will crash.

See Also
ContainerSearchCurrRadiusDist, ContainerSearchNext, InitContainerRadiusSearch



ContainerSearchCurrRadiusDist()

Purpose
Use the ContainerSearchCurrDist function when using InitContainerRadiusSearch and ContainerSearchNext functions to find objects to determine the distance of the closest point of the last object found from the center of the current search container.

Returns
Returns a floating point value equal to the distance between center of the container search box and the point on the last found item that is closest to the container center.

Notes
Caution! Do not call this function without first setting up a search container or the engine will crash.

See Also
ContainerSearchCurrDist, ContainerSearchNext, InitContainerRadiusSearch

%rad = ContainerSearchCurrRadiusDist();



ContainerSearchNext()

Purpose
Use the ContainerSearchNext function to find the next object in the currently defined search container.

Returns
Returns non-zero integer value equal to the ID of an object, or zero if no objects were found.

Notes
Caution! Do not call this function without first setting up a search container or the engine will crash.

See Also
ContainerSearchCurrDist, ContainerSearchCurrRadiusDist, InitContainerRadiusSearch



InitContainerRadiusSearch ( centerPos , radius , mask )

Purpose

Use the InitContainerRadiusSearch function to find all objects matching the specified mask type within a bounding radius centered at centerPos.

Syntax
centerPos
– An XYZ vector specifying the world position of the search container's centroid.
radius – A floating-point value specifying the radius of the search container.
mask – A bitmask corresponding to the type of objects to check for. See the 'Object Types Table'.

Returns
No return value.

Notes
This search is static. That is it will find all objects within the specified radius and then the found objects can be retrieved with ContainerSearchNext. To find new objects, you will have to re-initialize the search.

See Also
ContainerSearchCurrDist, ContainerSearchCurrRadiusDist, ContainerSearchNext


Section Index


1. OpenAL || 2. Debugging || 3. String Manipulation || 4. Networking || 5. Console || 6. Device I/O || 7. File I/O
8. Packages || 9. Objects || 10. Event Scheduling || 11. Datablocks || 12. Video / Texturing || 13. Special || 14. Resource Management
15. Scene || 16. Containers and Raycasts || 17. Editors || 18. Build || 19. Time || 20. GUIs || 21. Math