diguyImpact

Generated from diguyImpact.h

DI-Guy API Version 12.5.1

This file was automatically generated from diguyImpact.h. Do not edit this file directly; the changes will be lost.
Includes: declspec_diguy.h | diguy_constants.h | diguy_vector_classes.h

Contents:

Alphabetical Index

Link against: libdiguy

class diguyImpact

class BDI_DECLSPEC_diguy diguyImpact
{
public:
    diguyImpactType get_impact_type();
    const char* get_impact_type_string();
    int get_num_hits();
    const char* get_attacker_name();
    diguyCharacter* get_attacker();
    const char* get_target_name();
    diguyCharacter* get_target();
    const char* get_hit_link_name();
    int get_hit_link_index();
    const char* get_hit_shape_name();
    int get_impact_number();
    void set_impact_number(int val);
    void set_impact_been_processed();
    int get_impact_been_processed();
    float get_x();
    float get_y();
    float get_z();
    void get_location(float* x, float* y, float* z);
    float get_impact_radius();
    float get_impact_speed();
    int get_location_in_link_coordinates(float* link_x,
        float* link_y,
        float* link_z);
    void reset();
    const char* get_munition_type();
    diguySceneObject* get_hit_scene_object();
    float get_normal_x();
    float get_normal_y();
    float get_normal_z();
    void get_impact_normal(float* x, float* y, float* z);
    void get_impact_velocity(float* x, float* y, float* z);
    int get_is_from_net_detonation();
    int get_DIS_munition_septet_value(int septet_index);
    int get_DIS_site();
    int get_DIS_host();
    int get_DIS_event_number();
    int get_DIS_munition_number();
    int get_DIS_detonation_result();
    int get_DIS_burst_warhead_type();
    int get_DIS_burst_fuze();
    int get_DIS_burst_quantity();
    int get_DIS_burst_rate();
#ifdef CPLUSPLUS_ONLY
    void set_valid_impact();
    void set_target(diguyCharacter* target);
    void set_location(float x, float y, float z);
    void set_normal(float nx, float ny, float nz);
    void set_hit_scene_object(diguySceneObject* scene_object);
    void set_hit_link_index(int index);
    void set_hit_shape_index(int index);
Accessor functions
Unless otherwise noted all functions in this class section are callable from:

function diguyImpact::get_impact_type

Prototype:

diguyImpactType get_impact_type();
Description:

Returns the type of impact; this is based on how the collision was generated. Possible values are:

Note: NO_IMPACT is generated when a character fires but fails the hit ratio test. The location of the impact is then set to the attacker's position, or if that is unavailable to: (DIGUY_DEFAULT_FLOAT, DIGUY_DEFAULT_FLOAT, DIGUY_DEFAULT_FLOAT).

Returns:

the type of impact

function diguyImpact::get_impact_type_string

Prototype:

const char* 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:

function diguyImpact::get_num_hits

Prototype:

int get_num_hits();
Returns:

the number of hits made by this impact. This includes hits against characters and scene objects.

function diguyImpact::get_attacker_name

Prototype:

const char* get_attacker_name();
Returns:

the name of the attacker. This pointer may be NULL if there is no attacker character.

function diguyImpact::get_attacker

Prototype:

diguyCharacter* get_attacker();
Returns:

Returns a pointer to the attacker. This pointer may be NULL.

function diguyImpact::get_target_name

Prototype:

const char* 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).

function diguyImpact::get_target

Prototype:

diguyCharacter* 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).

function diguyImpact::get_hit_link_name

Prototype:

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

function diguyImpact::get_hit_link_index

Prototype:

int get_hit_link_index();
Returns:

index of the target character link that was hit

function diguyImpact::get_hit_shape_name

Prototype:

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

function diguyImpact::get_impact_number

Prototype:

int get_impact_number();
Returns:

the number of impacts the target character has taken

function diguyImpact::set_impact_number

Prototype:

void set_impact_number(int val);
Description:

Sets the impact number.

function diguyImpact::set_impact_been_processed

Prototype:

void set_impact_been_processed();
Description:

Sets that the impact has been processed.

function diguyImpact::get_impact_been_processed

Prototype:

int get_impact_been_processed();
Returns:

1 if the impact has been processed, 0 if not

function diguyImpact::get_x

Prototype:

float get_x();
Returns:

the approximate world x coordinate of the impact

function diguyImpact::get_y

Prototype:

float get_y();
Returns:

the approximate world y coordinate of the impact

function diguyImpact::get_z

Prototype:

float get_z();
Returns:

the approximate world z coordinate of the impact

function diguyImpact::get_location

Prototype:

void get_location(float* x, float* y, float* z);
Description:

Alternative method for getting the location of the impact.

function diguyImpact::get_impact_radius

Prototype:

float get_impact_radius();
Returns:

the radius of the impact

function diguyImpact::get_impact_speed

Prototype:

float get_impact_speed();
Returns:

the speed of the impact

function diguyImpact::get_location_in_link_coordinates

Prototype:

int get_location_in_link_coordinates(float* link_x,
    float* link_y,
    float* link_z);
Description:

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.

Arguments:

link_x, link_y, link_zlink-relative coordinates are
returned in these variables

Returns:

0 on success, -1 on failure

function diguyImpact::reset

Prototype:

void reset();
Description:

This function resets all of the impact data to default values.

function diguyImpact::get_munition_type

Prototype:

const char* get_munition_type();
Description:

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

function diguyImpact::get_hit_scene_object

Prototype:

diguySceneObject* get_hit_scene_object();
Description:

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

function diguyImpact::get_normal_x

Prototype:

float get_normal_x();
Returns:

approximate normal x coordinate of the impact; may not be valid

function diguyImpact::get_normal_y

Prototype:

float get_normal_y();
Returns:

approximate normal y coordinate of the impact; may not be valid

function diguyImpact::get_normal_z

Prototype:

float get_normal_z();
Returns:

approximate normal z coordinate of the impact; may not be valid

function diguyImpact::get_impact_normal

Prototype:

void get_impact_normal(float* x, float* y, float* z);
Description:

Alternative method for getting the normal of the impact.

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.

function diguyImpact::get_impact_velocity

Prototype:

void get_impact_velocity(float* x, float* y, float* z);
Description:

Velocity of projectile at impact. May be 0 if no velocity information is available.

function diguyImpact::get_is_from_net_detonation

Prototype:

int 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

function diguyImpact::get_DIS_munition_septet_value

Prototype:

int get_DIS_munition_septet_value(int septet_index);
Description:

This function returns the specified part of the DIS septet of the detonation's munition septet.

Arguments:

septet_indexwhich 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.

function diguyImpact::get_DIS_site

Prototype:

int get_DIS_site();
Returns:

the site id part of the detonation PDU event id; -1 if not set

function diguyImpact::get_DIS_host

Prototype:

int get_DIS_host();
Returns:

the host id part of the detonation PDU event id; -1 if not set

function diguyImpact::get_DIS_event_number

Prototype:

int get_DIS_event_number();
Returns:

the event number part of the detonation PDU event id; -1 if not set

function diguyImpact::get_DIS_munition_number

Prototype:

int get_DIS_munition_number();
Returns:

the event number part of the detonation PDU munition event id; -1 if not set

function diguyImpact::get_DIS_detonation_result

Prototype:

int get_DIS_detonation_result();
Returns:

the detonation result of the detonation PDU; -1 if not set

function diguyImpact::get_DIS_burst_warhead_type

Prototype:

int get_DIS_burst_warhead_type();
Returns:

the warhead type enumeration of the detonation PDU's burst descriptor; -1 if not set

function diguyImpact::get_DIS_burst_fuze

Prototype:

int get_DIS_burst_fuze();
Returns:

the fuze enumeration of the detonation PDU's burst descriptor; -1 if not set

function diguyImpact::get_DIS_burst_quantity

Prototype:

int get_DIS_burst_quantity();
Returns:

the burst quantity of the detonation PDU's burst descriptor; -1 if not set

function diguyImpact::get_DIS_burst_rate

Prototype:

int get_DIS_burst_rate();
Returns:

the burst rate of the detonation PDU's burst descriptor; -1 if not set

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

    diguyApp::get_app()->set_render_pass_flags(DIGUY_RENDER_PASS_INTERSECTION);
    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;
}

function diguyImpact::set_valid_impact

Prototype:

void set_valid_impact();
Description:

This function sets the impact to be valid. It must be called if the impact hits a character.

function diguyImpact::set_target

Prototype:

void set_target(diguyCharacter* target);
Description:

This function allows for explicitly setting the target character of this impact object.

Arguments:

x, y, zoverride target of impact
Callable From:

function diguyImpact::set_location

Prototype:

void set_location(float x, float y, float z);
Description:

This function allows for explicitly setting the position of this impact object.

Arguments:

x, y, zoverride position of impact
Callable From:

function diguyImpact::set_normal

Prototype:

void set_normal(float nx, float ny, float nz);
Description:

This function allows for explicitly setting the normal of this impact object.

Arguments:

nx, ny, nzoverride normal of impact
Callable From:

function diguyImpact::set_hit_scene_object

Prototype:

void set_hit_scene_object(diguySceneObject* scene_object);
Description:

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.

Arguments:

scene_objectpointer to scene object hit
Callable From:

function diguyImpact::set_hit_link_index

Prototype:

void set_hit_link_index(int index);
Description:

This function allows for explicitly setting the link index of this impact object.

Callable From:

function diguyImpact::set_hit_shape_index

Prototype:

void set_hit_shape_index(int index);
Description:

This function allows for explicitly setting the shape index of this impact object.

Callable From:


Alphabetical Index




Copyright (C) 1992-2012 Boston Dynamics

ALL RIGHTS RESERVED.

These coded instructions, statements, and computer programs contain unpublished proprietary information of Boston Dynamics and are protected by Copyright Laws of the United States. They may not be used, duplicated, or disclosed in any form, in whole or in part, without the prior written consent from Boston Dynamics.

RESTRICTED RIGHTS LEGEND

Use, duplication, or disclosure by the government is subject to restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Sofware clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR, or the DOD or NASA FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the Commercial Computer Software--Restricted Rights at 48 CFR 52.227-19, as applicable. Unpublished-rights reserved under the Copyright Laws of the United States.

Contractor/Manufacturer is:

Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.