The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

  use Rinchi::CIGIPP::CollisionDetectionVolumeDefinition;
  my $cdv_def = Rinchi::CIGIPP::CollisionDetectionVolumeDefinition->new();

  $packet_type = $cdv_def->packet_type();
  $packet_size = $cdv_def->packet_size();
  $entity_ident = $cdv_def->entity_ident(56515);
  $volume_ident = $cdv_def->volume_ident(33);
  $volume_type = $cdv_def->volume_type(Rinchi::CIGIPP->Sphere);
  $volume_enable = $cdv_def->volume_enable(Rinchi::CIGIPP->Enable);
  $x = $cdv_def->x(42.227);
  $y = $cdv_def->y(17.683);
  $z = $cdv_def->z(61.995);
  $radius = $cdv_def->radius(42.354);
  $height = $cdv_def->height(82.136);
  $width = $cdv_def->width(62.861);
  $depth = $cdv_def->depth(56.607);
  $roll = $cdv_def->roll(72.09);
  $pitch = $cdv_def->pitch(50.275);
  $yaw = $cdv_def->yaw(10.898);

DESCRIPTION

The Collision Detection Volume Definition packet enables the Host to define one or more collision detection volumes for an entity. A collision detection volume is a sphere or a cuboid through which collision testing is performed by the IG. When a collision detection volume passes through another collision detection volume, the IG registers a collision by sending a Collision Detection Volume Notification packet to the Host identifying the collided volumes.

Note that collision detection testing is performed every frame by the IG.

A volume is defined by specifying its location, size, and orientation with respect to the associated entity's body coordinate system. A sphere's size is specified as a radius; a cuboid's size is specified by its width, height, and depth. Unlike collision detection segments, which are tested segment-to-polygon, collision detection volumes are tested volume-to-volume. Volumes associated with the same entity are not tested against each other.

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

If the state of an entity is set to Inactive/Standby (0) via the Entity State attribute of an Entity Control packet, no collision detection volume testing will be performed for that entity.

If the Collision Detection Enable attribute of the Entity Control packet is set to Disabled (0), no volumes defined for the entity will be used as "source" volumes for collision testing.

If collision detection is enabled for two entities, two tests will be performed between each pair of volumes. This is because each volume will be used as both source and destination in each pair-wise test.

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

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

EXPORT

None by default.

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

new $cdv_def = Rinchi::CIGIPP::CollisionDetectionVolumeDefinition->new()

Constructor for Rinchi::CollisionDetectionVolumeDefinition.

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

Data Packet Identifier.

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

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

Data Packet Size.

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

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

Entity ID.

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

sub volume_ident([$newValue])
 $value = $cdv_def->volume_ident($newValue);

Volume ID.

This attribute specifies the ID of the volume. If an ID is specified for which a volume is already defined, that volume will be overwritten.

sub volume_type([$newValue])
 $value = $cdv_def->volume_type($newValue);

Volume Type.

This attribute specified whether the volume is spherical or cuboid.

    Sphere   0
    Cuboid   1
sub volume_enable([$newValue])
 $value = $cdv_def->volume_enable($newValue);

Volume Enable.

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

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

X.

This attribute specifies the X offset of the center of the volume. This offset is measured with respect to the coordinate system of the entity specified by the Entity ID attribute.

sub y([$newValue])
 $value = $cdv_def->y($newValue);

Y.

This attribute specifies the Y offset of the center of the volume. This offset is measured with respect to the coordinate system of the entity specified by the Entity ID attribute.

sub z([$newValue])
 $value = $cdv_def->z($newValue);

Z.

This attribute specifies the Z offset of the center of the volume. This offset is measured with respect to the coordinate system of the entity specified by the Entity ID attribute.

sub radius([$newValue])
 $value = $cdv_def->radius($newValue);

Radius.

For spherical collision detection volumes, this attribute specifies the radius of the sphere.

sub height([$newValue])
 $value = $cdv_def->height($newValue);

Height.

For cuboid collision detection volumes, this attribute specifies the length of the cuboid along its Z axis.

sub width([$newValue])
 $value = $cdv_def->width($newValue);

Width.

For cuboid collision detection volumes, this attribute specifies the length of the cuboid along its Y axis. This attribute is ignored if Volume Type is set to Sphere (0).

sub depth([$newValue])
 $value = $cdv_def->depth($newValue);

Depth.

For cuboid collision detection volumes, this attribute specifies the length of the cuboid along its X axis. This attribute is ignored if Volume Type is set to Sphere (0).

sub roll([$newValue])
 $value = $cdv_def->roll($newValue);

Roll.

For cuboid collision detection volumes, this attribute specifies the roll of the cuboid with respect to the entity's coordinate system. This attribute is ignored if Volume Type is set to Sphere (0).

sub pitch([$newValue])
 $value = $cdv_def->pitch($newValue);

Pitch.

For cuboid collision detection volumes, this attribute specifies the pitch of the cuboid with respect to the entity's coordinate system. This attribute is ignored if Volume Type is set to Sphere (0).

sub yaw([$newValue])
 $value = $cdv_def->yaw($newValue);

Yaw.

For cuboid collision detection volumes, this attribute specifies the yaw of the cuboid with respect to the entity's coordinate system. This attribute is ignored if Volume Type is set to Sphere (0).

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

Returns the packed data packet.

sub unpack()
 $value = $cdv_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 117:

'=item' outside of any '=over'

Around line 623:

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