Table of Contents

Struct BodyDefinition

Namespace
Box3D
Assembly
Box3D.NET.dll

Everything needed to create a body.

public readonly record struct BodyDefinition : IEquatable<BodyDefinition>

Implements

Inherited Members

Examples

// A crate falling from ten metres up.
var crate = world.CreateBody(BodyDefinition.Dynamic(new Vector3(0, 10, 0)));

// A moving platform the application drives itself.
var platform = world.CreateBody(BodyDefinition.Kinematic(start));

// Level geometry.
var ground = world.CreateBody(BodyDefinition.Static());

Remarks

This is a plain value that carries creation parameters. It holds no resources, is safe to reuse for many bodies, and can be discarded as soon as the body exists.

Start from Box3D.BodyDefinition.Default or one of the factory methods rather than from default: a zeroed definition has no rotation quaternion and no gravity scale, and the engine rejects it.

Create bodies where they belong. Creating one at the origin and moving it afterwards costs close to twice as much, and more once shapes are attached.

Properties

AllowFastRotation

Gets a value indicating whether the body may spin faster than the usual rotation limit.

AngularDamping

Gets the angular damping, which slows down spinning bodies.

AngularVelocity

Gets the initial angular velocity, in radians per second.

CanSleep

Gets a value indicating whether the body may fall asleep when it stops moving.

Default

Gets the engine's default definition, which describes a static body at the origin.

EnableContactRecycling

Gets a value indicating whether contact recycling is enabled.

GravityScale

Gets the multiplier applied to gravity for this body.

IsBullet

Gets a value indicating whether the body is treated as a bullet, using continuous collision against dynamic and kinematic bodies.

IsEnabled

Gets a value indicating whether the body takes part in the simulation at all.

LinearDamping

Gets the linear damping, which bleeds off linear velocity over time.

LinearVelocity

Gets the initial linear velocity, usually in metres per second.

MotionLocks

Gets the axes the body may not move along or rotate about.

Name

Gets an optional name, used when debugging and drawing.

Position

Gets the initial world position of the body origin.

Rotation

Gets the initial world rotation.

SleepThreshold

Gets the speed below which the body is considered still enough to sleep.

StartAwake

Gets a value indicating whether the body starts awake.

Type

Gets how the body participates in the simulation.

Methods

Dynamic(Vector3, Quaternion?)

Creates a definition for a dynamic body.

Kinematic(Vector3, Quaternion?)

Creates a definition for a kinematic body.

Static(Vector3, Quaternion?)

Creates a definition for a static body.