Package-level declarations

Types

Link copied to clipboard
@ConfigSerializable
data class Box(val halfExtent: DVec3, val margin: Double = 0.0) : Geometry

A cuboid centered around zero defined by its half-extent.

Link copied to clipboard
@ConfigSerializable
data class Capsule(val axis: LinAxis, val halfHeight: Double, val radius: Double) : Geometry

A "swept sphere" shape centered around zero defined by an axis, half-height and radius.

Link copied to clipboard

Which rule is applied to both friction or restitution coefficients of bodies that have come into contact, in order to determine the final coefficient.

Link copied to clipboard
interface Collider

A physical volume in space which can be collided with by other physics structures. This holds a shape and physics properties, and may be attached to a PhysicsSpace to simulate it inside that space. A collider may also be attached (parented) to a RigidBody, which will make the collider determine its position based on its parent body.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface ColliderKey

A key used to index into a PhysicsSpace to gain a reference, mutable or immutable, to a Collider.

Link copied to clipboard
data class Compound(val children: List<Compound.Child>) : Geometry

A shape consisting of multiple already-created sub-Shapes, which can be positioned at different Child.delta offsets to the root compound. Shapes from a Compound can not be a child, and you must provide at least one child.

Link copied to clipboard
@ConfigSerializable
data class Cone(val halfHeight: Double, val radius: Double, val margin: Double = DEFAULT_MARGIN) : Geometry

A cone shape centered around zero, with its length along the Y axis, defined by a half-height and radius. The shape starts at its largest radius at the bottom, and approaches zero at the top.

Link copied to clipboard
interface ContactManifold
Link copied to clipboard
data class ConvexDecomposition(val vertices: List<DVec3>, val indices: List<IVec3>, val vhacd: VhacdSettings = VhacdSettings(), val margin: Double = DEFAULT_MARGIN) : Geometry

A shape of unknown convexity which, when turned into a Shape, will be decomposed into a Compound of convex shapes using the implementation's convex decomposition algorithm (VHACD). Note that decomposition is very slow (relatively), so this step should be precomputed or cached in some form.

Link copied to clipboard
data class ConvexHull(val points: List<DVec3>, val margin: Double = DEFAULT_MARGIN) : Geometry

A convex shape defined by a set of points, which will be used to compute a convex hull (smallest convex shape containing the given points) when baked into a Shape.

Link copied to clipboard
data class ConvexMesh(val vertices: List<DVec3>, val indices: List<IVec3>, val margin: Double = DEFAULT_MARGIN) : Geometry

A shape assumed to be already convex, defined by an array of vertices and array of triangle face indices. If the shape is not convex, collision detection will not be accurate. Building a Shape out of this is faster than making one out of a ConvexHull, but is not as safe.

Link copied to clipboard
@ConfigSerializable
data class Cylinder(val halfHeight: Double, val radius: Double, val margin: Double = DEFAULT_MARGIN) : Geometry

A cylinder shape centered around zero, with its length along the Y axis, defined by a half-height and radius.

Link copied to clipboard
interface Destroyable

An object which is tied to a resource that must be manually destroyed after use. You must only call the destroy method once; implementations may throw an exception if a double-free is attempted.

Link copied to clipboard

Utility class for disallowing double-free in native resources.

Link copied to clipboard
enum Dof : Enum<Dof>

A degree of freedom in 3D space.

Link copied to clipboard
interface Geometry

A raw, serializable form of a physical volume that can be constructed by a user. You can not use this object as the shape of a Collider, however you can convert it into a Shape using PhysicsEngine.createShape. This object stores no information on world-space position; all parameters are given in local-space.

Link copied to clipboard
interface ImpulseJoint : Joint
Link copied to clipboard
interface ImpulseJointKey

A key used to index into a PhysicsSpace to gain a reference, mutable or immutable, to an ImpulseJoint.

Link copied to clipboard

A field in an InteractionGroup, consisting of InteractionLayers.

Link copied to clipboard
data class InteractionGroup(val memberships: InteractionField, val filter: InteractionField)

Specifies which Colliders a collider will collide with, by using bit masks of InteractionLayers. This object stores two InteractionFields:

Link copied to clipboard

A single layer which a Collider may be placed on, via an InteractionGroup.

Link copied to clipboard
interface Joint
Link copied to clipboard
interface JointAxis
Link copied to clipboard

A linear axis in 3D space.

Link copied to clipboard
interface MultibodyJoint : Joint
Link copied to clipboard

The entry point to the physics system; an engine represents the manager of all physics resources and structures. An engine is tied to a specific physics backend, and allows creating native objects to interface with the physics backend.

Link copied to clipboard
@ConfigSerializable
data class PhysicsMaterial(val friction: Double = DEFAULT_FRICTION, val restitution: Double = DEFAULT_RESTITUTION, val frictionCombine: CoeffCombineRule = CoeffCombineRule.AVERAGE, val restitutionCombine: CoeffCombineRule = CoeffCombineRule.AVERAGE)

A set of physical properties that can be applied to a Collider.

Link copied to clipboard

How a Collider behaves when other colliders come into contact with it.

Link copied to clipboard
interface PhysicsQuery
Link copied to clipboard

An independent object storing simulation data for a set of physics structures. This takes ownership of objects like RigidBody and Collider instances, and allows manipulating and querying the internal structures. An instance can be created through PhysicsEngine.createSpace.

Link copied to clipboard
interface RefCounted

An object which is tied to a resource that is reference-counted. Each time an object uses this resource, they acquire a reference (increment the refCount), and when that object stops using it, they release the reference. Once the number of references reaches 0, the object is destroyed.

Link copied to clipboard
interface RigidBody

A physics structure which simulates dynamics - velocity, forces, friction, etc. - when attached to a PhysicsSpace. A body may have Colliders attached to it, which provide the physical collision shape used in contact response.

Link copied to clipboard
interface RigidBodyKey

A key used to index into a PhysicsSpace to gain a reference, mutable or immutable, to a RigidBody.

Link copied to clipboard

How the dynamics of a body are simulated. See RigidBody for details.

Link copied to clipboard
interface Shape : RefCounted

A baked, physics-ready form of a Geometry. You can use this object as the shape of a Collider, however cannot get the original values of the Geometry back.

Link copied to clipboard
@ConfigSerializable
data class Sphere(val radius: Double) : Geometry

A ball centered around zero with a defined radius.

Link copied to clipboard
@ConfigSerializable
data class VhacdSettings(val concavity: Double = 0.01, val alpha: Double = 0.05, val beta: Double = 0.05, val resolution: Int = 64, val planeDownsampling: Int = 4, val convexHullDownsampling: Int = 4, val fillMode: VhacdSettings.FillMode = FillMode.FloodFill(), val convexHullApproximation: Boolean = true, val maxConvexHulls: Int = 1024)

Options for the VHACD convex decomposition process. See VHACD for details.

Properties

Link copied to clipboard

The default multiplier to slow a RigidBody's angular velocity down by on every physics step.

Link copied to clipboard
const val DEFAULT_FRICTION: Double = 0.5

The default friction of a PhysicsMaterial.

Link copied to clipboard
const val DEFAULT_LINEAR_DAMPING: Double = 0.05

The default multiplier to slow a RigidBody's linear velocity down by on every physics step.

Link copied to clipboard
const val DEFAULT_MARGIN: Double = 0.05

The default convex margin used by Geometry instances (see Geometry).

Link copied to clipboard
const val DEFAULT_RESTITUTION: Double = 0.0

The default restitution of a PhysicsMaterial.

Functions

Link copied to clipboard
fun numThreads(raw: Int, target: Int): Int

Utility function to determine a number of threads from a config option.