|
Retrieves the width , the length and the height of the given object.
The "length" is computed as the length of the object along the X axis
The "width" is computed as the length of the object along the y axis
The "height" is computed as the length of the object along the Z axis
The difference between this function and STATE_object_get_bounding_box()
is that that the values returend from this function are not going to change
when you move the object or turn it around in 90 degrees (or any number of degrees).
The width , length and height values are properties of the object and are
set according to the object data located in the world file or the object file.
In run time the only function that changes these properties is STATE_object_set_scale()
Q: If I have a car object in my world, what is consider the width and what is the length ?
A: It depends on how the car model is built or in other words the information of the car that is inside
the world file. If the car is built so that its back is towards the +X axis and its side is towards the Y axis
then the width return by this function will be the distance from one door to the other
and the length will be from the front of the car till the end (as you might expect)
If on the other hand the car is built so that the front window is towards the Y axis
than the width returned is actually the length and vice versa.
Note that you have an option in WorldBuilder to save all objects so that they are
facing the -X axis. This way the width and length get to be what you expect them to be.
Parameters:
[IN] object_handle:
The handle to the object
[OUT] length:
The length of the object along the X axis according to the initial state of the object
as defined in the world file (or the object file). If STATE_object_set_scale()
is used then the length returned by this function will be accordingly adjusted (according to scale[1])
[OUT] width:
The length of the object along the Y axis according to the initial state of the object
as defined in the world file (or the object file). If STATE_object_set_scale()
is used then the width returned by this function will be will be adjusted accordingly (according to scale[1])
[OUT] height:
The length of the object along the Z axis according to the initial state of the object
as defined in the world file (or the object file). If STATE_object_set_scale()
is used then the height returned by this function will be will be adjusted accordingly (according to scale[2])
Example:
double scale[3]={1,1,1};
STATEobject_set_scale(my_object, scale); reset the scaling so that the dimensions received will not be factored
double length, width, height;
STATE_object_get_dimensions(my_object, &length, &width, &height);
See also: STATE_object_set_dimensions(), STATE_object_get_bounding_box()
|