Kraken Logo

Kraken Engine

DocumentationGuidesShowcaseCommunity
Ctrl
K
Navigating the Docs
Building Docs
Overview
Anchor
AnimationController
Audio
Batcher
Body
Camera
Capsule
CastHit
CharacterBody
Circle
Collision
Color
DistanceJoint
Effect
Event
FilterJoint
Flip (Texture)
Font
ImageLayer
InputAction
Joint
Layer
Line
Map
MapObject
Mask
MotorJoint
MouseJoint
ObjectGroup
Orchestrator
PixelArray
PolarCoordinate
Polygon
PrismaticJoint
Rect
RevoluteJoint
RigidBody
Sample
Sampler
Shader
SheetStrip
StaticBody
Stream
Style
Terrain (TileSet)
Text
TextProperties
Texture
Tile (TileLayer)
Tile (TileSet)
TileLayer
TileResult (TileLayer)
TileSet
Timer
Transform
Tween
Vec2
Vertex
WeldJoint
WheelJoint
World

Built bydurkisneer1.Kraken Engine is open source and available onGitHub.

  1. Docs
  2. Classes
  3. Rigid Body

RigidBody

A dynamic physics body that responds to forces, impulses, and collisions. Access via the 'physics' submodule.

Experimental API:

The physics submodule is an experimental and new API that is highly susceptible to breaking changes in the future.

Inherits from Body.

Constructor

  • RigidBody(world: World) → RigidBodyRigidBody(world: World) → RigidBody

A dynamic physics body that responds to forces, impulses, and collisions.

Properties


NameDescriptionType
linear_velocityThe linear velocity of the body.Vec2
angular_velocityThe angular velocity of the body.float
linear_dampingThe linear damping of the body.float
angular_dampingThe angular damping of the body.float
fixed_rotationWhether the body has fixed rotation.bool
is_bulletWhether CCD is enabled for this body.bool
is_awakeWhether the body is currently awake and simulating.bool
massThe mass of the body.float

Methods


Wake

wake() → Nonewake() → None

Manually wake the body from sleep.

Apply Force

apply_force(force: Vec2, point: Vec2, wake: bool = True) → Noneapply_force(force: Vec2, point: Vec2, wake: bool = True) → None

Apply a force to the body at a specific point.

Args

  • force : The force vector to apply.
  • point : The point (in world coordinates) where the force is applied.
  • wake : Whether to wake the body if it's sleeping. Defaults to True.

Apply Force To Center

apply_force_to_center(force: Vec2, wake: bool = True) → Noneapply_force_to_center(force: Vec2, wake: bool = True) → None

Apply a force to the center of mass of the body.

Args

  • force : The force vector to apply.
  • wake : Whether to wake the body if it's sleeping. Defaults to True.

Apply Torque

apply_torque(torque: float, wake: bool = True) → Noneapply_torque(torque: float, wake: bool = True) → None

Apply a torque to the body.

Args

  • torque : The torque to apply.
  • wake : Whether to wake the body if it's sleeping. Defaults to True.

Apply Linear Impulse

apply_linear_impulse(impulse: Vec2, point: Vec2, wake: bool = True) → Noneapply_linear_impulse(impulse: Vec2, point: Vec2, wake: bool = True) → None

Apply a linear impulse to the body at a specific point.

Args

  • impulse : The impulse vector to apply.
  • point : The point (in world coordinates) where the impulse is applied.
  • wake : Whether to wake the body if it's sleeping. Defaults to True.

Apply Linear Impulse To Center

apply_linear_impulse_to_center(impulse: Vec2, wake: bool = True) → Noneapply_linear_impulse_to_center(impulse: Vec2, wake: bool = True) → None

Apply a linear impulse to the center of mass of the body.

Args

  • impulse : The impulse vector to apply.
  • wake : Whether to wake the body if it's sleeping. Defaults to True.

Apply Angular Impulse

apply_angular_impulse(impulse: float, wake: bool = True) → Noneapply_angular_impulse(impulse: float, wake: bool = True) → None

Apply an angular impulse to the body.

Args

  • impulse : The angular impulse to apply.
  • wake : Whether to wake the body if it's sleeping. Defaults to True.
PreviousRevoluteJoint
NextSample

On this page

ConstructorPropertiesMethodsWakeApply ForceApply Force To CenterApply TorqueApply Linear ImpulseApply Linear Impulse To CenterApply Angular Impulse