STATE_object_add_polygon

 

 



   *** Very useful
  
   Adds a polygon to the object.
  
   General remarks about object polygons
   -------------------------------------
   Please note that the points of the polygon should be in OBJECT_SPACE
   (for example 0,0,0 is the center of the object and not the center of the world)
   Adding polygons that are defined in the object space is very easy because we don't
   have to take care whether the object has moved or turned around. For example
   if we have an airplane that is flying then in object space the coordinates
   of the points that define a polygon on the airplane wing will always stay the same
   no matter how many maneuvers the airplane did.
   One can use the function STATE_object_convert_point_to_object_space()
   If the points of the polygon are only known in world space. 
  
   How do I get the object to begin with ?
   ---------------------------------------
   The object can come from three sources:
   1. You can create a new empty object simply by calling STATE_object_create();
   2. You can load the object from a file by using STATE_object_create_from_file();
   3. The object can be included in the world. In this case after you load your world with
      STATE_engine_load_world() you can use STATE_object_get_first_object(), STATE_object_get_next_object() and
      STATE_object_get_name()to check what objects you have inside the world. Note that
  	  If you use World Builder or Webmaker, you can use make any model to become an object
  	  simply by right clicking and selecting properties and then defining the model as a dynamic object.
  
   Return value
   -------------
   Returns OK or VR_ERROR
   If the return value is VR_ERROR it is probably because that the polygon is not valid.
   (for example it has only two points. 4 points not on the same plane. not convex,
   bitmap coordination are not valid etc ...see the STATE.log to catch the error)
  
   See also: STATE_object_create(), STATE_object_create_from_file()

 

 

Go to page 1      Select API

 

Copyright © 2007 3DSTATE Corporation. www.3dstate.com