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

=item * C<float32> C<$impulse> - the angular impulse in units of kg*m*m/s

=back

=head2 ApplyForce( $force, $point )

Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body.

Parameters:

=over 4

=item * C<Box2D::b2Vec2> C<$force> - the world force vector, usually in Newtons (N).

=item * C<Box2D::b2Vec2> C<$point> - the world position of the point of application.

=back

=head2 ApplyLinearImpulse( $impulse, $point )

Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body.

Parameters:

=over 4

=item * C<Box2D::b2Vec2> C<$impulse> - the world impulse vector, usually in N-seconds or kg-m/s.

=item * C<Box2D::b2Vec2> C<$point> - the world position of the point of application.

=back

=head2 ApplyTorque( $torque )

Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.

Parameters:

=over 4

=item * C<float32> C<$torque> - about the z-axis (out of the screen), usually in N-m.

=back

=head2 CreateFixture( $shape, $density )

Creates a fixture from a shape and attach it to this body. This is a convenience function. Use b2FixtureDef if you need to set parameters like friction, restitution, user data, or filtering. If the density is non-zero, this function automatically upd...

Parameters:



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