STATE_object_get_bounding_box_height_above_ground

 

 


   *** Might be usefull sometimes
  
   General description
   --------------------
  		Calculates the object bounding box bottom height above ground.
  		The object bounding box (see STATE_object_get_bounding_box() ) has 8 points
  		(like every box we know from real life ...) This function tests the height of
  		the four bottom points of the bounding box.
  		The function returns two numbers. The maximun height and the minimum height
  		Internally the function simply calls STATE_object_is_movement_possible()
  		four times ...
  
   Why do we need this function ?
   -------------------------------
  		For example lets say we want to put a house on a hillside
  		One way to do it is to take the point where the user clicked
  		(see STATE_engine_2D_point_to_3D_point() ) put the house above this point
  		and then move the house down so it's lpositioned correctly
  		The problem is that if we put the house on a hillside one side of the 
  		house would have a different height from the ground then the other side
  		(real life houses are always horizontal). In this situation no matter how much
  		down we drop the house it we will always have some part of the house
  		which are in the air or other parts which are below the ground
  		There is no perfect solution for this situation except to rebuild the
  		house in real-time according to the hill slop.
  		This function wont solve the problem it will only give you the
  		min and max height so you can decide how to continue.
  
   Return value:
  		Returns the polygon below the object at the point where height_max is obtained. Returns NULL if there is nothing below.
  
   Parameters:
  		[IN] object_handle: 
  				the object handle
  
  		[IN] fall_through_dynamic_objects:
  				YES or NO. If YES is given then the height of the object is the length along the world axis
  				between the bottom of the object and the top of the first object below the object
  				If NO is given here then the height is the length along the world axis
  				between the bottom of the object and the top of the first non-object below the object
  				note the the teminologies "object" and "dynamic object" are the same in 3DSTATE and could be
  				interchanged. They both mean an object that is dealt by the STATE_object_ API ...
  				
  
  		[OUT] height:
  				Through this parameter the function returns the calculated height above the ground
  			
  
   Example:
  		  an alternative to STATE_object_drop_down()
  		double min_height, max_height;
  		DWORD poly=STATE_object_get_bounding_box_height_above_ground(my_object, NO, &min_height, &max_height);
  		if(poly!=NULL)
  			STATE_object_move(my_object, WORLD_SPACE, 0,0, -max_height);
  		   Note that STATE_object_drop_down() would calculate the height
  		   according to the center of the object and not according the the max_height
  		   as shown here
   
   See also: STATE_object_drop_down()
  

 

 

Go to page 1      Select API

 

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