DI-Guy SDK Documentation  13.6
diguyPathShape Class Reference

Represents a scriptable api wrapping a diguy path shape, a curve defined by with a number of waypoints. More...

#include <diguyPathShape.h>

Public Member Functions

General Functions

Unless otherwise specified, callable from:

  • C++
  • Script
const char * get_name ()
 Returns the name of the path shape. More...
 
int set_name (const char *name)
 This function sets the name of this object. More...
 
long get_uid ()
 All path shapes are assigned a unique identifier, or uid. More...
 
int set_clamp_at_end_flag (int value)
 This function determines what happens to objects following this path when they reach the end. More...
 
int get_clamp_at_end_flag ()
 Returns: most recent setting of set_clamp_at_end_flag(). More...
 
int update ()
 This function should be called after all modifications have been made to the path shape and its waypoints and it is time to re-derive the overall path shape. More...
 
float get_length ()
 This function returns the total length of the path shape, in meters. More...
 
int get_point_at_distance (float distance_into_path_shape, float *x, float *y, float *z, float *rz, float *rx, float *ry)
 This function returns, via the passed variable pointers, the position and orientation of the point on the path shape at the specified distance. More...
 
Waypoint Functions

Unless otherwise specified, callable from:

  • C++
  • Script
int get_num_waypoints ()
 Returns: More...
 
diguyWaypointget_waypoint_at_index (int index)
 This function gets the waypoint at the specified index and returns a pointer to it. More...
 
diguyWaypointcreate_waypoint (float x=0.0f, float y=0.0f, float z=0.0f, float yaw=0.0f, float roll=0.0f, float pitch=0.0f, float weight=1.0f, int index=-1)
 This function creates a new waypoint that is added to the path shape. More...
 
int add_waypoint (diguyWaypoint *waypoint)
 This function adds a waypoint to the path shape. More...
 
int destroy_waypoint (diguyWaypoint *waypoint)
 This function destroys a waypoint on the path. More...
 
Navmesh Functions

Unless otherwise specified, callable from:

  • C++
  • Script
void set_use_as_navmesh_portal (int use_as_portal)
 This function tells the Navmesh regions to use this path as a connection between two regions. More...
 
int get_use_as_navmesh_portal ()
 This function returns if the path is being used as a connection between two regions. More...
 
void set_one_way_portal (int one_way)
 This function tells the Navmesh regions to use this path as a one way connection between two regions. More...
 
int get_one_way_portal ()
 This function returns if the path is being used as a one way connection between two regions. More...
 
Experimental Functions

The following functions are experimental and may change or disappear with no warning.

int translate (float tx, float ty, float tz)
 
int rotate_about_point (float rz, float rx, float ry, float rotation_pt_x, float rotation_pt_y, float rotation_pt_z)
 
int set_ground_clamp_when_on_path (int ground_clamp_when_on_path)
 
int get_ground_clamp_when_on_path ()
 

Private Functions

The functions and variables past this point are for internal use only.

No external access to them is expected or necessary.

bdiScenarioPathShapem_path_shape
 A pointer to internal data. More...
 
class bdiScenarioPathShape
 
class diguyScenario
 
bdiScenarioPathShapeget_scripted_object ()
 
 diguyPathShape (bdiScenarioPathShape *path_shape)
 A private constructor. More...
 

Detailed Description

Represents a scriptable api wrapping a diguy path shape, a curve defined by with a number of waypoints.

Constructor & Destructor Documentation

diguyPathShape::diguyPathShape ( bdiScenarioPathShape path_shape)
private

A private constructor.

Member Function Documentation

const char* diguyPathShape::get_name ( )

Returns the name of the path shape.

This pointer will never be NULL.

Returns:

name of the path shape

int diguyPathShape::set_name ( const char *  name)

This function sets the name of this object.

Returns:

0 on success, -1 on failure

long diguyPathShape::get_uid ( )

All path shapes are assigned a unique identifier, or uid.

This function returns this path shape's uid.

Note: unique identifiers will change between DI-Guy runs!

Returns:

unique identifier of object

int diguyPathShape::set_clamp_at_end_flag ( int  value)

This function determines what happens to objects following this path when they reach the end.

If 1, the object is restricted to stay at the end of the path.

If 0, the object will wrap to the beginning of the path.

Parameters
value1 to clamp, 0 to wrap

Returns:

0 on success, -1 on failure

int diguyPathShape::get_clamp_at_end_flag ( )

Returns: most recent setting of set_clamp_at_end_flag().

int diguyPathShape::update ( )

This function should be called after all modifications have been made to the path shape and its waypoints and it is time to re-derive the overall path shape.

This update is deferred for reasons of performance; if there are a lot of modifications to be made to the path shape they can all be done in a group with only a single final update.

A call to update() is typically required after certain calls are made on objects owned by the path, such as a diguyWaypoint. The documentation for function calls of these objects will state whether a subsequent update() call is necessary.

Returns:

0 on success, -1 on failure

float diguyPathShape::get_length ( )

This function returns the total length of the path shape, in meters.

Returns:

length of path shape in meters

int diguyPathShape::get_point_at_distance ( float  distance_into_path_shape,
float *  x,
float *  y,
float *  z,
float *  rz,
float *  rx,
float *  ry 
)

This function returns, via the passed variable pointers, the position and orientation of the point on the path shape at the specified distance.

Parameters
distance_into_path_shapedistance in meters into path shape of the desired point
x,y,zposition of point in meters from the origin
rz,rx,ryorientation of point in degrees counter-clockwise from the positive X axis

Returns:

0 on success, -1 on failure

int diguyPathShape::get_num_waypoints ( )

Returns:

the number of waypoints belonging to this path shape

diguyWaypoint* diguyPathShape::get_waypoint_at_index ( int  index)

This function gets the waypoint at the specified index and returns a pointer to it.

The returned waypoint can then be queried for information or modified.

Note that if the waypoint is modified, the update() function must be called to update the path shape.

Parameters
indexindex of the waypoint; indices start at 0

Returns:

pointer of type diguyWaypoint; NULL if no waypoint at the specified index

diguyWaypoint* diguyPathShape::create_waypoint ( float  x = 0.0f,
float  y = 0.0f,
float  z = 0.0f,
float  yaw = 0.0f,
float  roll = 0.0f,
float  pitch = 0.0f,
float  weight = 1.0f,
int  index = -1 
)

This function creates a new waypoint that is added to the path shape.

Do not call diguyScenario::destroy_waypoint() on the returned waypoint; it will be destroyed automatically with the path shape.

Parameters
tx,ty,tzposition in meters from the origin
rz,rx,ryorientations in degrees counter-clockwise from the positive X axis
weighthow much influence this waypoint exerts over the path curve
indexwhere the waypoint should be inserted in
thepath shape; indices start at 0; pass 1 to add to end of path shape

Returns:

pointer to type diguyWaypoint

int diguyPathShape::add_waypoint ( diguyWaypoint waypoint)

This function adds a waypoint to the path shape.

The waypoint should be created using the function diguyScenario::create_waypoint(), and destroyed using the function diguyScenario::destroy_waypoint().

An internal copy of the waypoint is made, so it can be destroyed right after this function call or used for other path shapes.

Parameters
waypointwaypoint to be appended to end of path

Returns:

0 on success, -1 on failure

int diguyPathShape::destroy_waypoint ( diguyWaypoint waypoint)

This function destroys a waypoint on the path.

Parameters
waypointwaypoint to be deleted

Returns:

0 on success, -1 on failure

void diguyPathShape::set_use_as_navmesh_portal ( int  use_as_portal)

This function tells the Navmesh regions to use this path as a connection between two regions.

The Navmesh should automatically choose the regions closest to the start and end points of the path. By default this functionality is off, but once activated it's assumed to be a two way connection.

Parameters
use_as_portal1 to use as a connection, 0 to not
int diguyPathShape::get_use_as_navmesh_portal ( )

This function returns if the path is being used as a connection between two regions.

Returns:

1 if is a connection, 0 if not

void diguyPathShape::set_one_way_portal ( int  one_way)

This function tells the Navmesh regions to use this path as a one way connection between two regions.

Defaults to 0 (two way connection)

Parameters
one_way1 to set as one way connection, 0 to set as bidirectional
int diguyPathShape::get_one_way_portal ( )

This function returns if the path is being used as a one way connection between two regions.

Returns:

1 if is one way connection, 0 if two way

int diguyPathShape::translate ( float  tx,
float  ty,
float  tz 
)
int diguyPathShape::rotate_about_point ( float  rz,
float  rx,
float  ry,
float  rotation_pt_x,
float  rotation_pt_y,
float  rotation_pt_z 
)
int diguyPathShape::set_ground_clamp_when_on_path ( int  ground_clamp_when_on_path)
int diguyPathShape::get_ground_clamp_when_on_path ( )
bdiScenarioPathShape* diguyPathShape::get_scripted_object ( )
inline

Friends And Related Function Documentation

friend class bdiScenarioPathShape
friend
friend class diguyScenario
friend

Member Data Documentation

bdiScenarioPathShape* diguyPathShape::m_path_shape
private

A pointer to internal data.


The documentation for this class was generated from the following file: