|
Another way of looping through all the objects that are loaded into the engine is by using the FOREACH_OBJECT macro.
Example:
FOREACH_OBJECT(obj) {
do something with the object. For rxsmple lets check its name
char *name=STATE_object_get_name(obj);
}
#define FOREACH_OBJECT(obj) for(DWORD obj=STATE_object_get_first_object(); obj!=NULL; obj=STATE_object_get_next_object(obj))
Set the location of the object
Example A:
DWORD object=STATE_object_get_first_object();
STATE_object_set_location(object, 10, 20, 30);
Example B:
double x=10,y=20,z=30;
DWORD object=STATE_object_get_first_object();
STATE_object_set_location(object, x, y, z);
Example C:
Note that instead of doing it as shown below, it is easier to use the function STATE_object_set_location1() instead
double xyz[3]={10,20,30};
DWORD object=STATE_object_get_first_object();
STATE_object_set_location(object, xyz[0], xyz[1], xyz[2]);
See also STATE_object_set_location1()
|