Physics SimulationBodyOn this pageBody Description: A class represents a physics body in the world. Class Object: Body Class. Inherits from: Node. world Type: Readonly Field. Description: The physics world that the body belongs to. Signature: const world: PhysicsWorld bodyDef Type: Readonly Field. Description: The definition of the body. Signature: const bodyDef: BodyDef mass Type: Readonly Field. Description: The mass of the body. Signature: const mass: number sensor Type: Readonly Field. Description: Whether the body is used as a sensor or not. Signature: const sensor: boolean velocityX Type: Field. Description: The x-axis velocity of the body. Signature: velocityX: number velocityY Type: Field. Description: The y-axis velocity of the body. Signature: velocityY: number velocity Type: Field. Description: The velocity of the body as a Vec2. Signature: velocity: Vec2 angularRate Type: Field. Description: The angular rate of the body. Signature: angularRate: number group Type: Field. Description: The collision group that the body belongs to. Signature: group: integer linearDamping Type: Field. Description: The linear damping of the body. Signature: linearDamping: number angularDamping Type: Field. Description: The angular damping of the body. Signature: angularDamping: number owner Type: Field. Description: The reference for an owner of the body. Signature: owner: Object receivingContact Type: Field. Description: Whether the body is currently receiving contact events or not. Signature: receivingContact: boolean applyLinearImpulse Type: Function. Description: Applies a linear impulse to the body at a specified position. Signature: applyLinearImpulse: function(self: Body, impulse: Vec2, pos: Vec2) Parameters: ParameterTypeDescriptionimpulseVec2The linear impulse to apply.posVec2The position at which to apply the impulse. applyAngularImpulse Type: Function. Description: Applies an angular impulse to the body. Signature: applyAngularImpulse: function(self: Body, impulse: number) Parameters: ParameterTypeDescriptionimpulsenumberThe angular impulse to apply. removeSensorByTag Type: Function. Description: Removes the sensor with the specified tag from the body. Signature: removeSensorByTag: function(self: Body, tag: integer): boolean Parameters: ParameterTypeDescriptiontagintegerThe tag of the sensor to remove. Returns: Return TypeDescriptionbooleanWhether a sensor with the specified tag was found and removed. attach Type: Function. Description: Attaches a fixture to the body. Signature: attach: function(self: Body, fixtureDef: FixtureDef) Parameters: ParameterTypeDescriptionfixtureDefFixtureDefThe fixture definition for the fixture to attach. getSensorByTag Type: Function. Description: Returns the sensor with the given tag. Signature: getSensorByTag: function(self: Body, tag: integer): Sensor Parameters: ParameterTypeDescriptiontagintegerthe tag of the sensor to get. Returns: Return TypeDescriptionSensorthe sensor with the given tag. removeSensor Type: Function. Description: Removes the given sensor from the body's sensor list. Signature: removeSensor: function(self: Body, sensor: Sensor): boolean Parameters: ParameterTypeDescriptionsensorSensorthe sensor to remove. Returns: Return TypeDescriptionbooleantrue if the sensor was successfully removed, false otherwise. attachSensor Type: Function. Description: Attaches a new sensor with the given tag and fixture definition to the body. Signature: attachSensor: function(self: Body, tag: integer, fixtureDef: FixtureDef): Sensor Parameters: ParameterTypeDescriptiontagintegerthe tag of the sensor to attach.fixtureDefFixtureDefthe fixture definition of the sensor. Returns: Return TypeDescriptionSensorthe newly attached sensor. onContactFilter Type: Function. Description: Register a function to be called when the body begins to receive contact events. Return false from this function to prevent colliding. Signature: onContactFilter: function(self: Body, filter: function(other: Body): boolean) Parameters: ParameterTypeDescriptionfilterfunctionThe filter function to set. onBodyEnter Type: Function. Description: Registers a callback function for when the body enters a sensor. Signature: onBodyEnter: function(self: Body, callback: function(other: Body, sensorTag: integer)) Parameters: ParameterTypeDescriptioncallbackfunctionThe callback function for when the body enters a sensor. onBodyLeave Type: Function. Description: Registers a callback function for when the body leaves a sensor. Signature: onBodyLeave: function(self: Body, callback: function(other: Body, sensorTag: integer)) Parameters: ParameterTypeDescriptioncallbackfunctionThe callback function for when the body leaves a sensor. onContactStart Type: Function. Description: Registers a callback function for when the body starts to collide with another object. This function sets the receivingContact property to true. Signature: onContactStart: function(self: Body, callback: function(other: Body, point: Vec2, normal: Vec2, enabled: boolean)) Parameters: ParameterTypeDescriptioncallbackfunctionThe callback function for when the body starts to collide with another object. onContactEnd Type: Function. Description: Registers a callback function for when the body stops colliding with another object. This function sets the receivingContact property to true. Signature: onContactEnd: function(self: Body, callback: function(other: Body, point: Vec2, normal: Vec2)) Parameters: ParameterTypeDescriptioncallbackfunctionThe callback function for when the body stops colliding with another object.