|
Move the camera up or down so its height above the ground
is according to the given parameters.
This function is quite useful, usually one calls it before moving the camera.
Imagine for example that we have stairs to climb. If calling this function
after moving the camera forward the result will be a very natural stairs climbing.
Note that this function is very simple inside. Some people might not use this function and
would rather write their own code.
Return Value.
Returns a handle to the polygon bellow.
If there is nothing below it will return NULL
Parameters:
camera_handle: the camera to be dropped.
double height_above_ground : set this argument to the desire height above the ground.
gravity : The maximum fall that the camera is allowed to make for each call of the function.
For example if the camera falls down from a building. The bigger this number is
the fewer calls (to this function) it will take till the camera reaches the ground.
In other words if the camera height above the ground is 100 and the camera is moving forward
on the top of a building, once it falls from the building the camera height from the floor will suddenly be
quite a big number, lets say 10000. If the gravity is 50 then after calling this function the camera will be set
at a height of 10000-50 above the ground.
If you didn't get all of this it doesn't matter, try different values till you reach the desired effect.
point_on_the_ground : The function returns through this parameter a point on the ground that is exactly
bellow the camera. If there is no polygon bellow the camera then this parameter will contain (0,0,0)
and the function return value will be NULL
See also STATE_camera_drop_down();
Example
double point_on_the_ground[3];
DWORD floor_polygon=STATE_camera_set_height_above_ground(my_camera, 100, 40,point_on_the_ground);
if(floor_polygon==NULL)
error_message("We are walking on air !!!);
|