<commit_before>package Chipmunk::Arbiter;

# ABSTRACT: Controls pairs of colliding shapes

use strict;
use warnings;
use Alien::Chipmunk;

require XSLoader;
XSLoader::load( 'Chipmunk::Arbiter', $Chipmunk::Arbiter::VERSION );

1;

__END__

=head1 SYNOPSIS

    # Arbiters are not created directly, they are passed to callback
    # functions.
    $space->set_default_collision_handler(
        sub {
            my ( $arbiter, $space, $data ) = @_;

            $arbiter->set_elasticity(0.5);
        },
        # ...
    );

=head1 DESCRIPTION

The Arbiter class controls pairs of colliding shapes.

They are also used in conjuction with collision handler callbacks
allowing you to retrieve information on the collision and control it.

=head1 METHODS

=head2 get_elasticity

=over 4

=item Arguments: none

=item Return Value: $elasticity

=back

The calculated elasticity for this collision pair. Setting the value in
a L<pre_solve|Chipmunk::Space/set_default_collision_handler> callback
will override the value calculated by the space.  The default
calculation multiplies the elasticity of the two shapes together.

=head2 set_elasticity

=over 4

=item Arguments: $elasticity

=item Return Value: not defined

=back

Set the elasticity.

=head2 get_friction

=over 4

=item Arguments: none

=item Return Value: $friction

=back

The calculated friction for this collision pair. Setting the value in
a L<pre_solve|Chipmunk::Space/set_default_collision_handler> callback
will override the value calculated by the space.  The default
calculation multiplies the friction of the two shapes together.

=head2 set_friction

=over 4

=item Arguments: $friction

=item Return Value: not defined

=back

=head2 get_surface_velocity

=over 4

=item Arguments: none

=item Return Value: $velocity

=back

The calculated surface velocity for this collision pair. Setting the
value in a L<pre_solve|Chipmunk::Space/set_default_collision_handler>
callback will override the value calculated by the space. the default
calculation subtracts the surface velocity of the second shape from the
first and then projects that onto the tangent of the collision. This is
so that only friction is affected by default calculation. Using a custom
calculation, you can make something that responds like a pinball bumper,
or where the surface velocity is dependent on the location of the
contact point.

B<NOTE>: Unfortunately there is an old bug where the surface velocity is
calculated backwards (negative). I didn't really notice this for a long
time. It will be fixed in Chipmunk 7, but for now I've left it alone for
backwards compatibility reasons.

=head2 set_surface_velocity

=over 4

=item Arguments: $velocity<commit_msg>Change friction docs<commit_after>package Chipmunk::Arbiter;

# ABSTRACT: Controls pairs of colliding shapes

use strict;
use warnings;
use Alien::Chipmunk;

require XSLoader;
XSLoader::load( 'Chipmunk::Arbiter', $Chipmunk::Arbiter::VERSION );

1;

__END__

=head1 SYNOPSIS

    # Arbiters are not created directly, they are passed to callback
    # functions.
    $space->set_default_collision_handler(
        sub {
            my ( $arbiter, $space, $data ) = @_;

            $arbiter->set_elasticity(0.5);
        },
        # ...
    );

=head1 DESCRIPTION

The Arbiter class controls pairs of colliding shapes.

They are also used in conjuction with collision handler callbacks
allowing you to retrieve information on the collision and control it.

=head1 METHODS

=head2 get_elasticity

=over 4

=item Arguments: none

=item Return Value: $elasticity

=back

The calculated elasticity for this collision pair. Setting the value in
a L<pre_solve|Chipmunk::Space/set_default_collision_handler> callback
will override the value calculated by the space.  The default
calculation multiplies the elasticity of the two shapes together.

=head2 set_elasticity

=over 4

=item Arguments: $elasticity

=item Return Value: not defined

=back

Set the elasticity.

=head2 get_friction

=over 4

=item Arguments: none

=item Return Value: $friction

=back

The calculated friction for this collision pair.  The default
calculation multiplies the friction of the two shapes together.

=head2 set_friction

=over 4

=item Arguments: $friction

=item Return Value: not defined

=back

Set the friction for this collision pair.  Setting the value in a
L<pre_solve|Chipmunk::Space/set_default_collision_handler> callback
will override the value calculated by the space.

=head2 get_surface_velocity

=over 4

=item Arguments: none

=item Return Value: $velocity

=back

The calculated surface velocity for this collision pair. Setting the
value in a L<pre_solve|Chipmunk::Space/set_default_collision_handler>
callback will override the value calculated by the space. the default
calculation subtracts the surface velocity of the second shape from the
first and then projects that onto the tangent of the collision. This is
so that only friction is affected by default calculation. Using a custom
calculation, you can make something that responds like a pinball bumper,
or where the surface velocity is dependent on the location of the
contact point.

B<NOTE>: Unfortunately there is an old bug where the surface velocity is
calculated backwards (negative). I didn't really notice this for a long
time. It will be fixed in Chipmunk 7, but for now I've left it alone for
backwards compatibility reasons.

=head2 set_surface_velocity

=over 4

=item Arguments: $velocity
{'fraction_non_alphanumeric': 0.057660626029654036, 'fraction_numerical': 0.006955885044847154, 'mean_word_length': 4.502517623363545, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1645317', 'n_tokens_mistral': 1659, 'n_tokens_neox': 1551, 'n_words': 688}