![]() |
DI-Guy SDK Documentation
13.5
|
A class that represents a bullet impact in the world, often used by AIs to make reaction decisions. More...
#include <diguyImpact.h>
Public Member Functions | |
Accessor functions | |
Unless otherwise noted all functions in this class section are callable from:
| |
| diguyImpactType | get_impact_type () |
| Returns the type of impact; this is based on how the collision was generated. More... | |
| const char * | get_impact_type_string () |
| Returns: the string version of the type of impact. More... | |
| int | get_num_hits () |
| Returns: the number of hits made by this impact. More... | |
| const char * | get_attacker_name () |
| Returns: the name of the attacker. More... | |
| diguyCharacter * | get_attacker () |
| Returns: Returns a pointer to the attacker. More... | |
| const char * | get_target_name () |
| Returns: the name of the target. More... | |
| diguyCharacter * | get_target () |
| Returns: the diguyCharacter impact target. More... | |
| const char * | get_hit_link_name () |
| Returns: name of the target character link that was hit; may be NULL if there is no hit target character. More... | |
| int | get_hit_link_index () |
| Returns: index of the target character link that was hit. More... | |
| const char * | get_hit_shape_name () |
| Returns: name of the target character shape that was hit; may be NULL if there is no hit target character. More... | |
| int | get_impact_number () |
| Returns: the number of impacts the target character has taken. More... | |
| void | set_impact_number (int val) |
| Sets the impact number. More... | |
| void | set_impact_been_processed () |
| Sets that the impact has been processed. More... | |
| int | get_impact_been_processed () |
| Returns: 1 if the impact has been processed, 0 if not. More... | |
| float | get_x () |
| Returns: the approximate world x coordinate of the impact. More... | |
| float | get_y () |
| Returns: the approximate world y coordinate of the impact. More... | |
| float | get_z () |
| Returns: the approximate world z coordinate of the impact. More... | |
| void | get_location (float *x, float *y, float *z) |
| Alternative method for getting the location of the impact. More... | |
| float | get_impact_radius () |
| Returns: the radius of the impact. More... | |
| float | get_impact_speed () |
| Returns: the speed of the impact. More... | |
| int | get_location_in_link_coordinates (float *link_x, float *link_y, float *link_z) |
| This function returns the location of the impact in link-relative coordinates. More... | |
| void | reset () |
| This function resets all of the impact data to default values. More... | |
| const char * | get_munition_type () |
| This function returns the name of the munition that was fired. More... | |
| diguySceneObject * | get_hit_scene_object () |
| Returns the hit diguySceneObject. More... | |
| float | get_normal_x () |
| Returns: approximate normal x coordinate of the impact; may not be valid. More... | |
| float | get_normal_y () |
| Returns: approximate normal y coordinate of the impact; may not be valid. More... | |
| float | get_normal_z () |
| Returns: approximate normal z coordinate of the impact; may not be valid. More... | |
| void | get_impact_normal (float *x, float *y, float *z) |
| Alternative method for getting the normal of the impact. More... | |
Experimental DIS Detonation Functions | |
The following functions are experimental. They are for accessing data from DIS detonations that result in DI-Guy impacts being generated. | |
| void | get_impact_velocity (float *x, float *y, float *z) |
| Velocity of projectile at impact. More... | |
| int | get_is_from_net_detonation () |
| Returns: 1 if impact was generated as a result of a network detonation (e.g. More... | |
| int | get_DIS_munition_septet_value (int septet_index) |
| This function returns the specified part of the DIS septet of the detonation's munition septet. More... | |
| int | get_DIS_site () |
| Returns: the site id part of the detonation PDU event id; -1 if not set. More... | |
| int | get_DIS_host () |
| Returns: the host id part of the detonation PDU event id; -1 if not set. More... | |
| int | get_DIS_event_number () |
| Returns: the event number part of the detonation PDU event id; -1 if not set. More... | |
| int | get_DIS_munition_number () |
| Returns: the event number part of the detonation PDU munition event id; -1 if not set. More... | |
| int | get_DIS_detonation_result () |
| Returns: the detonation result of the detonation PDU; -1 if not set. More... | |
| int | get_DIS_burst_warhead_type () |
| Returns: the warhead type enumeration of the detonation PDU's burst descriptor; -1 if not set. More... | |
| int | get_DIS_burst_fuze () |
| Returns: the fuze enumeration of the detonation PDU's burst descriptor; -1 if not set. More... | |
| int | get_DIS_burst_quantity () |
| Returns: the burst quantity of the detonation PDU's burst descriptor; -1 if not set. More... | |
| int | get_DIS_burst_rate () |
| Returns: the burst rate of the detonation PDU's burst descriptor; -1 if not set. More... | |
Utility Functions for Intersection Functions | |
The following functions are meant for users who are using diguyScenario::set_fire_weapon_intersection_function() to handle weapon firing in the SDK. In simple OpenGL environments diguy_default_fire_weapon_intersection_function() in diguy_graphics_ogl.h may give you reasonable results by rendering characters into the back buffer. Additionally there are a number of intersection programming examples that demonstrate putting the default rendering pipeline into picking mode. Handing the resulting color under the (x, y) impact location in the graphics buffer into diguyScenario::map_color_to_impact() allows you to retrieve an impact structure with much of this information. These functions are not callable from script. Example impact function: int impact_function(diguyImpact* impact,
float from_x,
float from_y,
float from_z,
float to_x,
float to_y,
float to_z,
diguyScenario* s)
{
// note the impact already has both the attacker and the munition type
// set when this function is called
glShadeModel(GL_FLAT);
// create narrow frustum
// turn on scissor test
// feed data into diguy camera if you want frustum culling to work
s->set_current_render_mode("intersection");
s->draw();
GLubyte pixel[3];
glReadPixels(x_center, y_center, 1, 1,
GL_RGB,
GL_UNSIGNED_BYTE,
(void *) pixel);
diguyImpact* new_impact = scenario->map_color_to_impact(pixel[0], pixel[1], pixel[2]);
// unpack data in new_impact into the callback object
impact->set_valid_impact();
impact->set_target(new_impact->get_target());
impact->set_hit_link_index(new_impact->get_hit_link_index());
impact->set_hit_shape_index(new_impact->get_hit_shape_index());
return 1;
}
| |
| void | set_valid_impact () |
| This function sets the impact to be valid. More... | |
| void | set_target (diguyCharacter *target) |
| This function allows for explicitly setting the target character of this impact object. More... | |
| void | set_location (float x, float y, float z) |
| This function allows for explicitly setting the position of this impact object. More... | |
| void | set_normal (float nx, float ny, float nz) |
| This function allows for explicitly setting the normal of this impact object. More... | |
| void | set_hit_scene_object (diguySceneObject *scene_object) |
| Returns the hit scene object. More... | |
| void | set_hit_link_index (int index) |
| This function allows for explicitly setting the link index of this impact object. More... | |
| void | set_hit_shape_index (int index) |
| This function allows for explicitly setting the shape index of this impact object. More... | |
A class that represents a bullet impact in the world, often used by AIs to make reaction decisions.
|
private |
Private constructors.
|
private |
| diguyImpactType diguyImpact::get_impact_type | ( | ) |
Returns the type of impact; this is based on how the collision was generated.
Possible values are:
**
Returns:
the type of impact
| const char* diguyImpact::get_impact_type_string | ( | ) |
Returns: the string version of the type of impact.
This is based on how the collision was generated. Possible values are:
| int diguyImpact::get_num_hits | ( | ) |
Returns: the number of hits made by this impact.
This includes hits against characters and scene objects.
| const char* diguyImpact::get_attacker_name | ( | ) |
Returns: the name of the attacker.
This pointer may be NULL if there is no attacker character.
| diguyCharacter* diguyImpact::get_attacker | ( | ) |
Returns: Returns a pointer to the attacker.
This pointer may be NULL.
| const char* diguyImpact::get_target_name | ( | ) |
Returns: the name of the target.
This pointer may be NULL if there is no impact target character (e.g., impact is against a scene object).
| diguyCharacter* diguyImpact::get_target | ( | ) |
Returns: the diguyCharacter impact target.
This pointer may be NULL if there is no impact target character (e.g., impact is against a scene object).
| const char* diguyImpact::get_hit_link_name | ( | ) |
Returns: name of the target character link that was hit; may be NULL if there is no hit target character.
| int diguyImpact::get_hit_link_index | ( | ) |
Returns: index of the target character link that was hit.
| const char* diguyImpact::get_hit_shape_name | ( | ) |
Returns: name of the target character shape that was hit; may be NULL if there is no hit target character.
| int diguyImpact::get_impact_number | ( | ) |
Returns: the number of impacts the target character has taken.
| void diguyImpact::set_impact_number | ( | int | val | ) |
Sets the impact number.
| void diguyImpact::set_impact_been_processed | ( | ) |
Sets that the impact has been processed.
| int diguyImpact::get_impact_been_processed | ( | ) |
Returns: 1 if the impact has been processed, 0 if not.
| float diguyImpact::get_x | ( | ) |
Returns: the approximate world x coordinate of the impact.
| float diguyImpact::get_y | ( | ) |
Returns: the approximate world y coordinate of the impact.
| float diguyImpact::get_z | ( | ) |
Returns: the approximate world z coordinate of the impact.
| void diguyImpact::get_location | ( | float * | x, |
| float * | y, | ||
| float * | z | ||
| ) |
Alternative method for getting the location of the impact.
| float diguyImpact::get_impact_radius | ( | ) |
Returns: the radius of the impact.
| float diguyImpact::get_impact_speed | ( | ) |
Returns: the speed of the impact.
| int diguyImpact::get_location_in_link_coordinates | ( | float * | link_x, |
| float * | link_y, | ||
| float * | link_z | ||
| ) |
This function returns the location of the impact in link-relative coordinates.
The function may fail and return -1 if a link was not hit by the impact.
| link_x,link_y,link_z | link-relative coordinates are returned in these variables |
Returns:
0 on success, -1 on failure
| void diguyImpact::reset | ( | ) |
This function resets all of the impact data to default values.
| const char* diguyImpact::get_munition_type | ( | ) |
This function returns the name of the munition that was fired.
This is useful for creating impact callbacks that respond differently to different weapons.
Returns:
the munition type of the impact; may be NULL
| diguySceneObject* diguyImpact::get_hit_scene_object | ( | ) |
Returns the hit diguySceneObject.
This pointer may be NULL if there is no impact scene object (e.g., impact is against a character).
If the octtree was used to generate the impact, this pointer will be NULL.
Returns:
pointer of type diguySceneObject
| float diguyImpact::get_normal_x | ( | ) |
Returns: approximate normal x coordinate of the impact; may not be valid.
| float diguyImpact::get_normal_y | ( | ) |
Returns: approximate normal y coordinate of the impact; may not be valid.
| float diguyImpact::get_normal_z | ( | ) |
Returns: approximate normal z coordinate of the impact; may not be valid.
| void diguyImpact::get_impact_normal | ( | float * | x, |
| float * | y, | ||
| float * | z | ||
| ) |
Alternative method for getting the normal of the impact.
| void diguyImpact::get_impact_velocity | ( | float * | x, |
| float * | y, | ||
| float * | z | ||
| ) |
Velocity of projectile at impact.
May be 0 if no velocity information is available.
| int diguyImpact::get_is_from_net_detonation | ( | ) |
Returns: 1 if impact was generated as a result of a network detonation (e.g.
a DIS detonation PDU), else 0
| int diguyImpact::get_DIS_munition_septet_value | ( | int | septet_index | ) |
This function returns the specified part of the DIS septet of the detonation's munition septet.
| septet_index | which part of the septet to return; must be between 0 (for 'kind') and 6 (for 'extra') |
Returns -1 if septet isn't specified, or on error.
| int diguyImpact::get_DIS_site | ( | ) |
Returns: the site id part of the detonation PDU event id; -1 if not set.
| int diguyImpact::get_DIS_host | ( | ) |
Returns: the host id part of the detonation PDU event id; -1 if not set.
| int diguyImpact::get_DIS_event_number | ( | ) |
Returns: the event number part of the detonation PDU event id; -1 if not set.
| int diguyImpact::get_DIS_munition_number | ( | ) |
Returns: the event number part of the detonation PDU munition event id; -1 if not set.
| int diguyImpact::get_DIS_detonation_result | ( | ) |
Returns: the detonation result of the detonation PDU; -1 if not set.
| int diguyImpact::get_DIS_burst_warhead_type | ( | ) |
Returns: the warhead type enumeration of the detonation PDU's burst descriptor; -1 if not set.
| int diguyImpact::get_DIS_burst_fuze | ( | ) |
Returns: the fuze enumeration of the detonation PDU's burst descriptor; -1 if not set.
| int diguyImpact::get_DIS_burst_quantity | ( | ) |
Returns: the burst quantity of the detonation PDU's burst descriptor; -1 if not set.
| int diguyImpact::get_DIS_burst_rate | ( | ) |
Returns: the burst rate of the detonation PDU's burst descriptor; -1 if not set.
| void diguyImpact::set_valid_impact | ( | ) |
This function sets the impact to be valid.
It must be called if the impact hits a character.
| void diguyImpact::set_target | ( | diguyCharacter * | target | ) |
This function allows for explicitly setting the target character of this impact object.
| x,y,z | override target of impact |
Callable From:
| void diguyImpact::set_location | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
This function allows for explicitly setting the position of this impact object.
| x,y,z | override position of impact |
Callable From:
| void diguyImpact::set_normal | ( | float | nx, |
| float | ny, | ||
| float | nz | ||
| ) |
This function allows for explicitly setting the normal of this impact object.
| nx,ny,nz | override normal of impact |
Callable From:
| void diguyImpact::set_hit_scene_object | ( | diguySceneObject * | scene_object | ) |
Returns the hit scene object.
This function allows for explicitly setting the scene_object that the impact object hit.
If the octtree was used to generate the impact, this pointer will be NULL.
| scene_object | pointer to scene object hit |
Callable From:
| void diguyImpact::set_hit_link_index | ( | int | index | ) |
This function allows for explicitly setting the link index of this impact object.
Callable From:
| void diguyImpact::set_hit_shape_index | ( | int | index | ) |
This function allows for explicitly setting the shape index of this impact object.
Callable From:
|
private |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| int diguyImpact::m_is_from_net_detonation |
| int diguyImpact::m_DIS_munition_septet[7] |
| int diguyImpact::m_DIS_site |
| int diguyImpact::m_DIS_host |
| int diguyImpact::m_DIS_event_number |
| int diguyImpact::m_DIS_munition_number |
| int diguyImpact::m_DIS_detonation_result |
| int diguyImpact::m_DIS_burst_warhead_type |
| int diguyImpact::m_DIS_burst_fuze |
| int diguyImpact::m_DIS_burst_quantity |
| int diguyImpact::m_DIS_burst_rate |
| float diguyImpact::m_impact_velocity[3] |