STATE_object_set_absolute_speed

 

 


  Relevant only when CHASE_PHYSICS or CHASE_TRACK is used.
  Set the size of the speed.
  
   Read the example below to learn how it all works. 
  
   Example:
  		STATE_object_set_speed(object, 0,10,0);
  		speed_size=STATE_object_get_absolute_speed(object);
  		  speed_size is now 10
  
  		STATE_object_set_absolute_speed(object, 100);
  
  		double speed[3];
  		STATE_object_get_speed(object, speed);
  		  speed is now { 0, 100, 0}
  
  
   Advanced:
  	In physics speed is a vector it has a size and a direction
  	Q: If the speed vector is 6,8,0 ( STATE_object_set_speed(object, 6,8,0) );
  	   what is the size of the speed (what will STATE_object_get_absolute_speed(object) return ?)
  
  
  	A:	Let calculate the vector size according to Pythagoras Theorem
  		speed size=  Square root of ( A*A+ B*B+ C*C ) = square root of ( 6*6 + 8*8 + 0*0) = Square root of (100) == 10
  
  	

 

 

Go to page 1      Select API

 

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