|
*** could be needed sometimes
This function redefines the object axis system accoring to its current position
If you are moving a car on a track and it is going backwards you might want to have a look at this function
Ulternatively to using this function you can open the object model in any 3D editor
and turn it around till it is positioned they way you want it.
The 3DSTATE 3D Engine assumes that object that are loaded to the engine are constructed
so that their back side points toward the positive X axis. Thier right side towards the positive Y axis
and their top side towards the Z axis. Many times you use a ready made models that
are not positioned in this way; this is OK because usually the engine doesn't care which is the front side and which is the back side of a car
or any other model. For the 3D Engine it is just a bunch of polygons. However some functions
of the engine need to know what is the orientation of the object (what direction is back, which one is front, top etc ...)
For example when using the STATE_object_chase_ function family.
When the object is requested to chase a track (to follow a given path in the world) automatically
for example STATE_object_set_chase_type(my_car, CHASE_TRACK) then the engine needs to know
which is the front side and which is the back so it can move the car along the track with the front wheels leading the way ...
This function is also useful whenever one wants to redefine the object axis system for conviniency matters
or to make objects that come from different model library have the same orientation
To use this function, first simply position / rotate the object till its back side is towards the positive X axis
(a camera located at (X, 0, 0) and looking in the direction (-1,0,0) will see the back of the object )
and then call the function to reset/redefined the object axis system
See also the Scale.exe utility (part of the our 3D Developer Studio). This utility has an option to rotate an object and save it
so one can use this utility instead of this function
Example:
DWORD my_obj=STATE_object_create_from_file("my_car.3dstate");
STATE_object_rotate_z(my_obj, 180, WORLD_SPACE);
STATE_object_redefine_axis_system(my_obj);
|