GameTools gameIsect

From Wikiid
Jump to: navigation, search

These functions perform intersection testing with a 3D model stored as a PLIB scene graph.

NOTE 1: Each of these takes an isectCollideCB callback function to 'filter' the resulting collision data. As each potential collision candidate comes along, it is passed into this function (which you provide) in order to determine whether the material it is made of is valid for collisions. In this manner, it is possible to avoid collisions with smoke clouds or other insubstantial objects based only on what they are made of. The callback function should return true if the object is 'collidable' or false otherwise. It should look something like this:

 bool isCollidableCB ( ssgLeaf *l )
 {
   MatEntry *me = (MatEntry *)(((ssgSimpleState *)( l -> getState () )) -> getUserData () ) ;
   return me == NULL || me -> isCollidable () ;
 }

NOTE 2: Since these functions use the PLIB collision routines, it is also possible to lock out entire sub-trees of the scene graph - or replace complex objects with simpler ones for collision testing purposes - using the PLIB traversal masks.

Sphere-versus-world

Takes the root of the scene graph in scene, the sphere to test with in sphere and the filter callback. It returns an array of ssgHit structures. The number of hits is returned in the location pointed to by nhits:

 ssgHit **isectGetCollisionData ( ssgBranch     *scene    ,
                                  sgSphere      *sphere   ,
                                  isectCollideCB callback ,
                                  int           *nhits    ) ;

CollisionVolume-versus-world

Takes the root of the scene graph in scene, an isectCollisionVolume as the object to test with, the object which the collision volume represents and the filter callback. It returns an array of ssgHit structures. The number of hits is returned in the location pointed to by nhits:

 ssgHit **isectGetCollisionData ( ssgBranch            *scene    ,
                                  isectCollisionVolume *colvol   ,
                                  ssgTransform         *target   ,
                                  isectCollideCB        callback ,
                                  int                  *nhits    ) ;

Point-versus-world (Height of Terrain)

Takes the root of the scene graph in scene, an point in space (my_position) and returns:

  • The height of that point above the nearest surface vertically below it.
  • The ssgHit structure of that surface.
  • The surface normal of that surface.

The isectGetHeight version does not return the normal vector.

 float  isectGetHeightAndNormal ( ssgBranch *scene,
                                  sgVec3 my_position,
                                  sgVec3 normal,
                                  ssgHit **hit = NULL,
                                  isectCollideCB callback = NULL ) ;
 float  isectGetHeight          ( ssgBranch     *br,
                                  sgVec3         my_position,
                                  ssgHit       **hit      = NULL,
                                  isectCollideCB callback = NULL )


Wikiid Pages relating to gameTools (edit)
gameTools - Main page
gameTools - Support Tools :
plb_to_ac3d, mklevel, mktile, mktree, tiled, autogen_java, mk3dgallery
gameTools - File Formats :
title_screen.rgb, ultimate.xml, material.xml, decoration.xml, physics.xml
tiled.xml, tiled_autotiles.xml, Level files, Tile naming scheme, PLB files
gameTools - Source Code :
Game functions: gameCamera, gameClock, gameChecksum/gameHashTable, gameHTTP,
gameIsect, gameJoystick, gameParticleManager, gameScreen/gameMouse,
gameSky, gameStarter, gameStrokeFont, gameUtils
Material database: MatList/MatEntry
Tile map handling: TileObject/MapFlag/MapEntry/Map
Java Interfacing: JavaLink
Image file loading: liImage/liImageFactory
3D Model file loading: loadPLB, PLB exporter
Physics: Sabot, Bullet, gameTools - Use with Blender, PLB exporter
Object management: Object


Wikiid Pages relating to Lemur of Lima (edit)
Lemur of Lima - Main page
Lemur of Lima - Controls
Lemur of Lima - Levels :
List of Levels, Level design, Screen shots, Models
Lemur of Lima - Java Plugins :
Java plugin API, Event handling, Flags, GameInterface API , Alphabetical Index
Lemur of Lima - Source Code Documentation :
Initialisation, Main Loop, gameTools