diff --git a/doc/base/classes.xml b/doc/base/classes.xml index a885b999890..1b95899729c 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -15204,7 +15204,7 @@ returns:= "username=user&password=pass" - Set the path to the A node for the joint. Must be of type PhysicsBody2D. + Set the path to the A node for the joint. Must be of type [PhysicsBody2D]. @@ -15218,7 +15218,7 @@ returns:= "username=user&password=pass" - Set the path to the B node for the joint. Must be of type PhysicsBody2D. + Set the path to the B node for the joint. Must be of type [PhysicsBody2D]. @@ -15389,8 +15389,12 @@ returns:= "username=user&password=pass" + Kinematic body 2D node. + Kinematic bodies are special types of bodies that are meant to be user-controlled. They are not affected by physics at all (to other types of bodies, such a character or a rigid body, these are the same as a static body). They have however, two main uses: + Simulated Motion: When these bodies are moved manually, either from code or from an AnimationPlayer (with process mode set to fixed), the physics will automatically compute an estimate of their linear and angular velocity. This makes them very useful for moving platforms or other AnimationPlayer-controlled objects (like a door, a bridge that opens, etc). + Kinematic Characters: KinematicBody2D also has an api for moving objects (the [method move] method) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics. @@ -15399,6 +15403,7 @@ returns:= "username=user&password=pass" + Move the body in the given direction, stopping if there is an obstacle. @@ -15407,6 +15412,7 @@ returns:= "username=user&password=pass" + Move the body to the given position. This is not a teleport, and the body will stop if there is an obstacle. @@ -15415,68 +15421,82 @@ returns:= "username=user&password=pass" + Return true if there would be a collision if the body moved in the given direction. + Return the last movement done by the body. + Undo the last movement done by the body. + Return whether the body is colliding with another. + Return the point in space where the body is touching another. If there is no collision, this method will return (0,0), so collisions must be checked first with [method is_colliding]. + Return the normal of the surface the body collided with. This is useful to implement sliding along a surface. + Return the velocity of the body that collided with this one. + Return the body that collided with this one. + Return the shape index from the body that collided with this one. If there is no collision, this method will return 0, so collisions must be checked first with [method is_colliding]. + + + Return the metadata of the shape that collided with this body. If there is no collision, it will return 0, so collisions must be checked first with [method is_colliding]. Aditionally, this metadata can not be set with [method Object.set_meta], it must be set with [method Physics2DServer.body_set_shape_metadata]. + Set the collision margin for this object. A collision margin is an amount (in pixels) that all shapes will grow when computing collisions, to account for numerical imprecision. + Return the collision margin for this object. @@ -28306,7 +28326,7 @@ This method controls whether the position between two cached points is interpola Rigid body 2D node. - Rigid body 2D node. This node is used for placing rigid bodies in the scene. It can contain a number of shapes, and also shift state between regular Rigid Body to Character or even Static. + Rigid body 2D node. This node is used for placing rigid bodies in the scene. It can contain a number of shapes, and also shift state between regular Rigid body, Kinematic, Character or Static. Character mode forbids the node from being rotated. This node can have a custom force integrator function, for writing complex physics motion behavior per node. As a warning, don't change this node position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop will yield strange behavior. @@ -28329,7 +28349,7 @@ This method controls whether the position between two cached points is interpola - Return the current body mode, see [set_mode]. + Return the current body mode, see [method set_mode]. @@ -28350,14 +28370,14 @@ This method controls whether the position between two cached points is interpola - Set the body mass given standard earth-weight (gravity 9.8). Not really useful for 2D since most measures for this node are in pixels. + Set the body weight given standard earth-weight (gravity 9.8). Not really useful for 2D since most measures for this node are in pixels. - Return the body mass given standard earth-weight (gravity 9.8). + Return the body weight given standard earth-weight (gravity 9.8). @@ -28378,7 +28398,7 @@ This method controls whether the position between two cached points is interpola - Set the body bounciness, from 0 (no bounce) to 1 (bounce). + Set the body bounciness, from 0 (no bounce) to 1 (full bounce). @@ -28392,36 +28412,42 @@ This method controls whether the position between two cached points is interpola + Set The gravity factor. This factor multiplies gravity intensity just for this body. + Return the gravity factor. + Set the linear damp for this body. If this value is different from -1, any linear damp derived from the world or areas will be overriden. + Return the linear damp for this body. + Set the angular damp for this body. If this value is different from -1, any angular damp derived from the world or areas will be overriden. + Return the angular damp for this body. @@ -28435,7 +28461,7 @@ This method controls whether the position between two cached points is interpola - Return the body linear velocity. This changes by physics granularity. See [set_linear_velocity]. + Return the body linear velocity. This changes by physics granularity. See [method set_linear_velocity]. @@ -28449,7 +28475,7 @@ This method controls whether the position between two cached points is interpola - Return the body angular velocity. This changes by physics granularity. See [set_angular_velocity]. + Return the body angular velocity. This changes by physics granularity. See [method set_angular_velocity]. @@ -28463,14 +28489,14 @@ This method controls whether the position between two cached points is interpola - Return the maximum contacts that can be reported. See [set_max_contacts_reported]. + Return the maximum contacts that can be reported. See [method set_max_contacts_reported]. - Set to true if the body shall not do any internal force integration at all (like gravity or air friction). Only the [_integrate_forces] will be able to integrate them if overrided. + Set to true if the body shall not do any internal force integration at all (like gravity or air friction). Only the [method _integrate_forces] will be able to integrate them if overrided. @@ -28484,7 +28510,7 @@ This method controls whether the position between two cached points is interpola - Enable contact monitoring. (the signals to notify when a body entered/exited collision). + Enable contact monitoring. This allows the body to emit signals when it collides with another. @@ -28498,19 +28524,22 @@ This method controls whether the position between two cached points is interpola + Set the continuous collision detection mode from the enum CCD_MODE_*. + Coninuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. The first is more precise, and misses less impacts by small, fast-moving objects. The second is faster to compute, but can miss small, fat-moving objects. + Return whether this body is using continuous collision detection. - Set an axis velocity. The velocity in the given vector axis will be set as the given vector length. (This is useful for jumping behavior). + Set an axis velocity. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior. @@ -28519,31 +28548,35 @@ This method controls whether the position between two cached points is interpola - Apply a positioned impulse (which will be affected by the body mass and shape). + Apply a positioned impulse (which will be affected by the body mass and shape). This is the equivalent of hitting a billiard ball with a cue: a force that is applied once, and only once. + Set the applied force vector. This is the equivalent of pushing a box over the ground: the force applied is applied constantly. + Return the applied force vector. + Set whether a body is isleeping or not. Sleeping bodies are not affected by forces until a collision or an [method apply_impulse]/[method set_applied_force] wakes them up. Until then, they behave like a static body. + Return whether the body is sleeping. @@ -28551,13 +28584,14 @@ This method controls whether the position between two cached points is interpola Set the body ability to fall asleep when not moving. This saves an enormous amount of processor time when there are plenty of rigid bodies (non static) in a scene. + Sleeping bodies are not affected by forces until a collision or an [method apply_impulse]/[method set_applied_force] wakes them up. Until then, they behave like a static body. - Return true if the body has the ability to fall asleep when not moving. See [set_can_sleep]. + Return true if the body has the ability to fall asleep when not moving. See [method set_can_sleep]. @@ -28570,12 +28604,14 @@ This method controls whether the position between two cached points is interpola + Return whether the body would collide, if it tried to move in the given vector. This method allows two extra parameters: A margin, which increases slightly the size of the shapes involved in the collision detection, and an object of type [Physics2DTestMotionResult], which will store additional information about the collision (should there be one). + Return a list of the bodies colliding with this one. @@ -28584,7 +28620,7 @@ This method controls whether the position between two cached points is interpola - Emitted when a new body enters into contact with this one. Contact monitor and contacts reported must be enabled for this to work. + Emitted when a body enters into contact with this one. Contact monitor and contacts reported must be enabled for this to work. @@ -28597,7 +28633,8 @@ This method controls whether the position between two cached points is interpola - Emitted when a new body sub-shape enters into contact with this one. Contact monitor and contacts reported must be enabled for this to work. + Emitted when a body enters into contact with this one. Contact monitor and contacts reported must be enabled for this to work. + This signal not only receives the body that collided with this one, but also its [RID] (body_id), the shape index from the colliding body (body_shape), and the shape index from this body (local_shape) the other body collided with. @@ -28618,26 +28655,31 @@ This method controls whether the position between two cached points is interpola Emitted when a body shape exits contact with this one. Contact monitor and contacts reported must be enabled for this to work. + This signal not only receives the body that stopped colliding with this one, but also its [RID] (body_id), the shape index from the colliding body (body_shape), and the shape index from this body (local_shape) the other body stopped colliding with. - Static mode (does not move, can't be moved). + Static mode. The body behaves like a [StaticBody2D], and can only move by user code. + Kinematic body. The body behaves like a [KinematicBody2D], and can only move by user code. - Rigid body, can move and rotate. + Rigid body. This is the "natural" state of a rigid body. It is affected by forces, and can move, rotate, and be affected by user code. - Character body, can move but not rotate. + Character body. This behaves like a rigid body, but can not rotate. + Disables continuous collision detection. This is the fastest way to detect body collisions, but can miss small, fast-moving objects. + Enables continuous collision detection by raycasting. It is faster than shapecasting, but less precise. + Enables continuous collision detection by shapecasting. It is the slowest CCD method, and the most precise. @@ -32760,7 +32802,7 @@ This method controls whether the position between two cached points is interpola - Set a constant linear velocity for the body. + Set a constant linear velocity for the body. This does not move the body, but affects other bodies touching it, as if it was moving. @@ -32774,7 +32816,7 @@ This method controls whether the position between two cached points is interpola - Return the constant linear velocity for the body. + Return the constant linear velocity for the body. This does not rotate the body, but affects other bodies touching it, as if it was rotating. @@ -32788,24 +32830,28 @@ This method controls whether the position between two cached points is interpola + Set the body friction, from 0 (frictionless) to 1 (full friction). + Return the body friction. + Set the body bounciness, from 0 (not bouncy) to 1 (bouncy). + Return the body bounciness.