|
Checks whether a given object can move from one point to another inside the world
Return value: YES or NO.
If movement is possible the function will return YES else returns NO
If movement is not possible it returns the plane equation Ax+By+Cz+D=0
and the intersection point.
Note that the normal of the blocking surface is N=( plane[0], plane[1], plane[2])
on return blocking_object is the object that make movement impossible
if the return value is NO and blocking_object==NULL it means
that what blocks us is the static part of the world.
the difference between this function end STATE_engine_is_movement_possible()
is that here we also give the handle to the dynamic object that wants to move.
This handle is needed so that the function can eliminate the object itself
from being the obstacle that makes the movement impossible.
see also remarks on STATE_engine_is_movement_possible()
Arguments:
object_handle: The object that we want to move. The engine will disable this object
for doing the collision detection as explained in the remarks above.
start_point, end_point: The function will check collision between the world and a line going from start_point to end_point
intersected_polygon: If there is a collision going from the start point to the end point then the function will return
the blocking polygon using this argument.
intersection: an x,y,x point on the intersected_polygon where the line from start_point to end_point intersects
blocking_object: If the intersection is caused because of another dynamic object that the blocking object will be returned
using this argument.
Remark:
Note that this function doesn't take a camera handle as one of its parameters.
Note also that the result of the operation is dependent on the current camera that is used.
The engine will use the current camera (The camera that was used in the last render)
In most of the cases this is the right thing to do. In the case when you want
to use a different camera for the calculation then use STATE_camera_set_current()
Before calling this function.
Example:
double start_point[3]={1,2,3};
double end_point[3]={100,200,300};
DWORD intersected_polygon;
double intersection[3];
DWORD blocking_object[3];
STATE_object_is_movement_possible(my_object ,start_location, end_location, &intersected_polygon, intersection, &blocking_object);
|