Box2D

 view release on metacpan or  search on metacpan

lib/pods/Box2D/b2Body.pod  view on Meta::CPAN


=head1 NAME

Box2D::b2Body - A rigid body.

=head1 SYNOPSIS

  my $body = $world->CreateBody( $body_def );

  my $fixture = $body->CreateFixture();

  my $position = $body->GetPosition();

  my $center = $body->GetWorldCenter();

  $body->SetAngularVelocity( $v );
  $body->SetLinearVelocity( Box2D::b2Vec2->new( $vx, $vy ) );

=head1 DESCRIPTION

A rigid body. These are created via C<Box2D::b2World::CreateBody>.

=head1 METHODS

=head2 ApplyAngularImpulse( $impulse )

Apply an angular impulse.

Parameters:

=over 4

lib/pods/Box2D/b2BodyDef.pod  view on Meta::CPAN


=head1 NAME

Box2D::b2BodyDef - Holds all the data needed to construct a rigid body.

=head1 SYNOPSIS

  my $body_def = Box2D::b2BodyDef->new();
  $body_def->type( Box2D::b2_dynamicBody );
  $body_def->position->Set( $x, $y );
  $body_def->angle( $theta );
  my $body = $world->CreateBody( $body_def );

=head1 DESCRIPTION

A body definition holds all the data needed to construct a rigid body.
You can safely re-use body definitions. Shapes are added to a body after
construction.

=head1 METHODS

=head2 new()

This constructor sets the body definition default values.

Returns a C<Box2D::b2BodyDef>

lib/pods/Box2D/b2ContactImpulse.pod  view on Meta::CPAN

  for my $i ( 0 .. $contact->GetManifold()->pointCount() - 1 ) {

      my $impulse = $contactImpulse->normalImpulses( $i );

      # Do something
  }

=head1 DESCRIPTION

Contact impulses for reporting. Impulses are used instead of forces
because sub-step forces may approach infinity for rigid body
collisions. These match up one-to-one with the contact points in
C<Box2D::b2Manifold>.

=head1 METHODS

=head2 normalImpulses( $index )

Parameters:

=over 4

lib/pods/Box2D/b2DistanceJoint.pod  view on Meta::CPAN


=head1 SYNOPSIS

  my $joint = $world->CreateJoint( $joint_def );
  my $anchor_a = $joint->GetAnchorA();
  my $anchor_b = $joint->GetAnchorB();

=head1 DESCRIPTION

A distance joint constrains two points on two bodies to remain at a
fixed distance from each other. You can view this as a massless, rigid
rod.

=head1 METHODS

=head2 GetAnchorA()

Get the anchor point on bodyA in world coordinates. Implements
C<Box2D::b2Joint>.

Returns a C<Box2D::b2Vec2>

lib/pods/Box2D/b2Transform.pod  view on Meta::CPAN


Box2D::b2Transform - Contains translation and rotation.

=head1 SYNOPSIS

  my $transform = Box2D::b2Transform->new( $postiion, $rotation );

=head1 DESCRIPTION

A transform contains translation and rotation. It is used to represent
the position and orientation of rigid frames.

=head1 METHODS

=head2 new( $position, $R )

Initialize using a position vector and a rotation matrix.

Parameters:

=over 4

lib/pods/Box2D/b2World.pod  view on Meta::CPAN


Call this after you are done with time steps to clear the forces.
You normally call this after each call to Step, unless you are
performing sub-steps. By default, forces will be automatically cleared,
so you don't need to call this function.

See also: SetAutoClearForces

=head2 CreateBody( $def )

Create a rigid body given a definition. No reference to the definition
is retained.

Warning: This function is locked during callbacks.

Parameters:

=over 4

=item * C<Box2D::b2BodyDef> C<$def>

lib/pods/Box2D/b2World.pod  view on Meta::CPAN

=over 4

=item * C<Box2D::b2JointDef> C<$def>

=back

Returns a C<Box2D::b2Joint>

=head2 DestroyBody( $body )

Destroy a rigid body given a definition. No reference to the definition
is retained. This function is locked during callbacks.

Warning: This automatically deletes all associated shapes and joints.
This function is locked during callbacks.

Parameters:

=over 4

=item * C<Box2D::b2Body> C<$body>



( run in 1.844 second using v1.01-cache-2.11-cpan-5735350b133 )