Brian M. Ames
and 1 contributors

NAME

Rinchi::CIGIPP::CollisionDetectionSegmentDefinition - Perl extension for the Common Image Generator Interface - Collision Detection Segment Definition data packet. data packet. =head1 SYNOPSIS

  use Rinchi::CIGIPP::CollisionDetectionSegmentDefinition;
  my $cds_def = Rinchi::CIGIPP::CollisionDetectionSegmentDefinition->new();

  $packet_type = $cds_def->packet_type();
  $packet_size = $cds_def->packet_size();
  $entity_ident = $cds_def->entity_ident(58547);
  $segment_ident = $cds_def->segment_ident(64);
  $segment_enable = $cds_def->segment_enable(Rinchi::CIGIPP->Disable);
  $x1 = $cds_def->x1(27.907);
  $y1 = $cds_def->y1(79.193);
  $z1 = $cds_def->z1(1.157);
  $x2 = $cds_def->x2(42.937);
  $y2 = $cds_def->y2(47.855);
  $z2 = $cds_def->z2(49.825);
  $material_mask = $cds_def->material_mask(38021);

DESCRIPTION

The Collision Detection Segment Definition packet enables the Host to define one or more collision detection segments for an entity. A collision detection segment is a line segment along which collision testing is performed by the IG. When a collision detection segment intersects a polygon, the IG registers a collision by sending a Collision Detection Segment Notification (Section 4.2.13) packet to the Host identifying the segment and the object with which it collided. Note that collision detection testing is performed every frame by the IG.

The segment is defined by specifying the locations of its endpoints with respect to the associated entity's body coordinate system.

Collision detection volumes (segments?) are tested segment-to-polygon. An entity will not perform collision detection segment testing against its own geometry. If the Collision Detection Enable attribute of an Entity Control packet is set to Disabled (0), the referenced entity's segments will not be used for collision detection segment testing. If the state of an entity is set to Inactive/Standby (0) via the Entity State attribute of an Entity Control packet, neither that entity's segments nor its geometry will be included in collision detection segment testing.

If an entity is destroyed, any collision detection segments defined for that entity will also be destroyed.

Although non-entity collision detection segments may be defined by the IG configuration, the Host can only create collision detection segments by referencing an entity. If a segment must be defined along a non-entity object, the Host must first create an entity with no geometry (entity type zero) to represent that object.

Since collision tests are conducted at discrete moments in time, it is possible that a segment could pass completely through a polygon between successive tests, causing a missed collision. It may therefore be necessary for the IG to use segment sweeping or some other mechanism to avoid this situation.

EXPORT

None by default.

#==============================================================================

new $cds_def = Rinchi::CIGIPP::CollisionDetectionSegmentDefinition->new()

Constructor for Rinchi::CollisionDetectionSegmentDefinition.

sub packet_type()
 $value = $cds_def->packet_type();

Data Packet Identifier.

This attribute identifies this data packet as the Collision Detection Segment Definition packet. The value of this attribute must be 22.

sub packet_size()
 $value = $cds_def->packet_size();

Data Packet Size.

This attribute indicates the number of bytes in this data packet. The value of this attribute must be 40.

sub entity_ident([$newValue])
 $value = $cds_def->entity_ident($newValue);

Entity ID.

This attribute specifies the entity for which the segment is defined.

sub segment_ident([$newValue])
 $value = $cds_def->segment_ident($newValue);

Segment ID.

This attribute specifies the identifier of the segment. If a segment is already defined with the same Segment ID, that segment will be overwritten.

sub segment_enable([$newValue])
 $value = $cds_def->segment_enable($newValue);

Segment Enable.

This attribute specifies whether the segment is enabled or disabled. If it is set to Disable (0), the specified segment is ignored during collision testing.

    Disable   0
    Enable    1
sub x1([$newValue])
 $value = $cds_def->x1($newValue);

X1.

This attribute specifies the X offset of one endpoint of the collision segment. This offset is measured with respect to the coordinate system of the entity specified by the Entity ID attribute. The X offset of the other endpoint is defined by the X2 attribute.

sub y1([$newValue])
 $value = $cds_def->y1($newValue);

Y1.

This attribute specifies the Y offset of one endpoint of the collision segment. This offset is measured with respect to the coordinate system of the entity specified by the Entity ID attribute. The Y offset of the other endpoint is defined by the Y2 attribute.

sub z1([$newValue])
 $value = $cds_def->z1($newValue);

Z1.

This attribute specifies the Z offset of one endpoint of the collision segment. This offset is measured with respect to the coordinate system of the entity specified by the Entity ID attribute. The Z offset of the other endpoint is defined by the Z2 attribute.

sub x2([$newValue])
 $value = $cds_def->x2($newValue);

X2.

This attribute specifies the X offset of one endpoint of the collision segment. This offset is measured with respect to the coordinate system of the entity specified by the Entity ID attribute. The X offset of the other endpoint is defined by the X1 attribute.

sub y2([$newValue])
 $value = $cds_def->y2($newValue);

Y2.

This attribute specifies the Y offset of one endpoint of the collision segment. This offset is measured with respect to the coordinate system of the entity specified by the Entity ID attribute. The Y offset of the other endpoint is defined by the Y1 attribute.

sub z2([$newValue])
 $value = $cds_def->z2($newValue);

Z2.

This attribute specifies theZ offset of one endpoint of the collision segment. This offset is measured with respect to the coordinate system of the entity specified by the Entity ID attribute. The Z offset of the other endpoint is defined by the Z1 attribute.

sub material_mask([$newValue])
 $value = $cds_def->material_mask($newValue);

Material Mask.

This attribute specifies the environmental and cultural features to be included in or excluded from consideration for collision testing. Each bit represents a range of material code values. Setting that bit to one (1) will cause the IG to register hits with materials within the corresponding range.

Refer to the appropriate IG documentation for material code assignments.

sub pack()
 $value = $cds_def->pack();

Returns the packed data packet.

sub unpack()
 $value = $cds_def->unpack();

Unpacks the packed data packet.

sub byte_swap()
 $obj_name->byte_swap();

Byte swaps the packed data packet.

SEE ALSO

Refer the the Common Image Generator Interface ICD which may be had at this URL: http://cigi.sourceforge.net/specification.php

AUTHOR

Brian M. Ames, <bmames@apk.net>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Brian M. Ames

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6 or, at your option, any later version of Perl 5 you may have available.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 106:

'=item' outside of any '=over'

Around line 521:

You forgot a '=back' before '=head1'