BodyDesc¶
Extends EngineObject.
What a body is made of and how it behaves: the shape, how it moves, its mass, surface and layers. Fill one in and give it to PhysicsWorld.AddBody; the same description can make any number of bodies. Where the body is comes from its entity's transform (its scale is applied to the shape).
Create one with BodyDesc.new().
Properties¶
shape: PhysicsShape?What it collides as. Required.motion: MotionKindmass: numberThe mass in kilograms of a dynamic body; 0 takes it from the shape's volume and Density.density: numberKilograms per cubic meter, for a body with no Mass (water is 1000).friction: numberrestitution: numberHow much of its speed a body keeps when it bounces: 0 to 1.linear_damping: numberThe fraction of linear speed lost per second.angular_damping: numbergravity_factor: number1 is the world's gravity, 0 none, negative lifts.layers: numberThe collision layers the body is in, a bit each (PhysicsLayers).mask: numberThe layers it collides with.is_sensor: booleanA sensor does not collide: it reports the bodies inside it (PhysicsWorld.SensorEntered).events: booleanReport its contacts (PhysicsWorld.ContactBegan) and when it wakes or sleeps. Off by default: events cost something for every pair.allow_sleeping: booleanbullet: booleanCheck the whole path of a fast body instead of its position at each step (bullets, fast wheels), so it cannot tunnel through thin walls. Costs more.center_of_mass: Vector3?Where the center of mass is, in the body's space, when it is not where the shape's volume puts it (a truck's engine and axles are low: (0, 0.9, 0.5)). Unset keeps the shape's. A vehicle drives well only with a low center.linear_velocity: Vector3angular_velocity: Vector3