bt
Canonical Import
fennel
(local bt (require :bt))Source Files
src/lua_physics.cppsrc/physics.h
What It Provides
bt exposes the Bullet-backed physics binding used by Space for rigid bodies, collision shapes, dynamics worlds, constraints, vehicles, and runtime physics integration. physics is a search alias for this canonical bt module, not an importable module page.
API Summary
- Math and transforms:
Scalar,Vector3,Quaternion, andTransform. - Collision shapes and meshes:
TriangleMesh,BvhTriangleMeshShape,HeightfieldTerrainShape,StaticPlaneShape,BoxShape,SphereShape, and sharedCollisionShapemethods. - Bodies and motion:
DefaultMotionState,RigidBodyConstructionInfo,RigidBody,CollisionObject, and activation/collision flag constants. - Worlds and setup:
DefaultCollisionConfiguration,CollisionDispatcher,DbvtBroadphase,SequentialImpulseConstraintSolver,DiscreteDynamicsWorld, andSoftRigidDynamicsWorld. - Constraints and vehicles:
Point2PointConstraint,VehicleTuning,DefaultVehicleRaycaster, andRaycastVehicle. Physicsexposes engine-owned world helpers such assetGravity,addRigidBody,removeRigidBody,updateSingleAabb,syncMovedRigidBody,addAction,removeAction,addConstraint,removeConstraint,getNumConstraints,getWorld, andupdate.
Examples
fennel
(local bt (require :bt))
(local shape (bt.BoxShape (bt.Vector3 0.5 0.5 0.5)))
(local transform (bt.Transform))
(transform:setIdentity)
(transform:setOrigin (bt.Vector3 0 5 0))
(local motion (bt.DefaultMotionState transform))
(local info (bt.RigidBodyConstructionInfo 1.0 motion shape (bt.Vector3 0 0 0)))
(local body (bt.RigidBody info))Errors and Platform Notes
Constructors validate required pointers and dimensions. For example, heightfield width/length must be greater than 1 and the heights table length must equal width * length; Point2PointConstraint requires a rigid body. Manage object lifetimes carefully because Bullet worlds and shapes may hold native pointers.
Related Modules
glmfor rendering-side math values.perlin-terrain-nativefor terrain meshes that can add triangles tobt.TriangleMesh.
Aliases and Search Terms
Search terms: physics, Bullet, bt, rigid body, collision shape, dynamics world, constraint, vehicle, heightfield.
